pub struct PolicyRule {
pub effect: String,
pub command: Option<Vec<String>>,
pub read: Option<Vec<String>>,
pub edit: Option<Vec<String>>,
pub mcp: Option<String>,
pub reason: Option<String>,
}Expand description
One [[policy.rules]] entry, as written.
effect stays a string here so that effect = "allow" can be refused
with the reason rather than a parser’s list of variants.
Fields§
§effect: String§command: Option<Vec<String>>§read: Option<Vec<String>>§edit: Option<Vec<String>>§mcp: Option<String>§reason: Option<String>Implementations§
Source§impl PolicyRule
impl PolicyRule
Sourcepub fn effect(&self) -> Result<PolicyEffect>
pub fn effect(&self) -> Result<PolicyEffect>
The rule’s effect. allow is refused with the reason there is none.
Sourcepub fn subject(&self) -> Result<PolicySubject<'_>>
pub fn subject(&self) -> Result<PolicySubject<'_>>
The rule’s single subject.
Trait Implementations§
Source§impl Clone for PolicyRule
impl Clone for PolicyRule
Source§impl Debug for PolicyRule
impl Debug for PolicyRule
Source§impl<'de> Deserialize<'de> for PolicyRule
impl<'de> Deserialize<'de> for PolicyRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PolicyRule
Source§impl PartialEq for PolicyRule
impl PartialEq for PolicyRule
Source§impl Serialize for PolicyRule
impl Serialize for PolicyRule
impl StructuralPartialEq for PolicyRule
Auto Trait Implementations§
impl Freeze for PolicyRule
impl RefUnwindSafe for PolicyRule
impl Send for PolicyRule
impl Sync for PolicyRule
impl Unpin for PolicyRule
impl UnsafeUnpin for PolicyRule
impl UnwindSafe for PolicyRule
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.