-
Notifications
You must be signed in to change notification settings - Fork 107
Description
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 the HashMap::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 theHashMap
's len()
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?
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change