pub struct PolicyContext {
pub stype: SType,
pub operation: Operation,
pub principal: Option<String>,
pub metadata: HashMap<String, String>,
pub payload_size: Option<usize>,
}Expand description
Context for policy evaluation
Fields§
§stype: STypeSType being operated on
operation: OperationOperation type
principal: Option<String>Principal (user/service ID)
metadata: HashMap<String, String>Additional metadata
payload_size: Option<usize>Payload size (if applicable)
Implementations§
Source§impl PolicyContext
impl PolicyContext
Sourcepub fn with_principal(self, principal: impl Into<String>) -> Self
pub fn with_principal(self, principal: impl Into<String>) -> Self
Set principal
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata
Sourcepub fn with_payload_size(self, size: usize) -> Self
pub fn with_payload_size(self, size: usize) -> Self
Set payload size
Trait Implementations§
Source§impl Clone for PolicyContext
impl Clone for PolicyContext
Source§fn clone(&self) -> PolicyContext
fn clone(&self) -> PolicyContext
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 moreAuto Trait Implementations§
impl Freeze for PolicyContext
impl RefUnwindSafe for PolicyContext
impl Send for PolicyContext
impl Sync for PolicyContext
impl Unpin for PolicyContext
impl UnwindSafe for PolicyContext
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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