pub struct PolicyRepository { /* private fields */ }Expand description
In-memory policy data loaded from the repository.
Implementations§
Source§impl PolicyRepository
impl PolicyRepository
Sourcepub fn load_from_root(root: &Path) -> Result<Self, PolicyError>
pub fn load_from_root(root: &Path) -> Result<Self, PolicyError>
Loads .agent/modes and .agent/approvals from the repository root.
§Errors
Returns PolicyError when the directories cannot be read or when a
YAML file fails to deserialize into the expected policy type.
Sourcepub fn mode(&self, slug: &str) -> Result<&ModeSpec, PolicyError>
pub fn mode(&self, slug: &str) -> Result<&ModeSpec, PolicyError>
Returns a mode by slug.
§Errors
Returns PolicyError::MissingMode when the requested mode is not
present in the loaded repository policy.
Sourcepub fn approval_profile(
&self,
slug: &ApprovalProfileSlug,
) -> Result<&ApprovalProfile, PolicyError>
pub fn approval_profile( &self, slug: &ApprovalProfileSlug, ) -> Result<&ApprovalProfile, PolicyError>
Returns an approval profile by slug.
§Errors
Returns PolicyError::MissingApprovalProfile when the requested
profile was not loaded from .agent/approvals.
Trait Implementations§
Source§impl Clone for PolicyRepository
impl Clone for PolicyRepository
Source§fn clone(&self) -> PolicyRepository
fn clone(&self) -> PolicyRepository
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PolicyRepository
impl Debug for PolicyRepository
Source§impl PartialEq for PolicyRepository
impl PartialEq for PolicyRepository
impl Eq for PolicyRepository
impl StructuralPartialEq for PolicyRepository
Auto Trait Implementations§
impl Freeze for PolicyRepository
impl RefUnwindSafe for PolicyRepository
impl Send for PolicyRepository
impl Sync for PolicyRepository
impl Unpin for PolicyRepository
impl UnsafeUnpin for PolicyRepository
impl UnwindSafe for PolicyRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.