Add convenience methods for the number of the Policies and Templates in a PolicySet #1179
Closed
1 of 2 tasks
Labels
feature-request
This issue requets a substantial new feature
Category
User level API features/changes
Describe the feature you'd like to request
Hey Cedar team,
My use case involves loading policies from a database and creating a
cedar_policy::PolicySet
with those. I'd like to introduce some assertions/safety checks so that I can make sure that the number of policies that I have in the policy set equals the amount of policies that I loaded.To do this I suggest we add
cedar_policy::PolicySet::num_of_policies() -> usize
(happy to chat about the name, of course), and similar for templates. These methods would be simple proxies for theHashMap::len()
.Describe alternatives you've considered
This is possible today using the provided iterators (like here), but doing that requires consuming the iterator. A call to the
HashMap
'slen()
would be more efficient.Additional context
I'm still using 2.4.x, so I need to to backport to that version.
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: