pub struct PermissionContext {
domain: Option<PermissionDomain>,
world: Option<Identifier>,
custom_contexts: Vec<PermissionRuleContext>,
}Expand description
Active runtime context used to evaluate permission rules.
Fields§
§domain: Option<PermissionDomain>§world: Option<Identifier>§custom_contexts: Vec<PermissionRuleContext>Implementations§
Source§impl PermissionContext
impl PermissionContext
Sourcepub fn for_world(world: Identifier) -> Self
pub fn for_world(world: Identifier) -> Self
Creates a context for a loaded world and its owning domain.
Sourcepub fn from_rule_context(
rule_context: &PermissionRuleContext,
) -> Result<Self, PermissionRuleContextError>
pub fn from_rule_context( rule_context: &PermissionRuleContext, ) -> Result<Self, PermissionRuleContextError>
Builds the active context represented by one rule-side expression.
World namespaces are Steel domain names, matching command-visible world identifiers.
§Errors
Returns an error if a custom context value conflicts with another value.
fn append_rule_context( &mut self, rule_context: &PermissionRuleContext, ) -> Result<(), PermissionRuleContextError>
Sourcepub fn with_custom_context(
self,
key: PermissionContextKey,
value: impl Into<String>,
) -> Result<Self, PermissionRuleContextError>
pub fn with_custom_context( self, key: PermissionContextKey, value: impl Into<String>, ) -> Result<Self, PermissionRuleContextError>
Adds one custom active context.
§Errors
Returns an error for an empty value or a conflicting value for the same key.
Sourcepub fn add_custom_context(
&mut self,
key: PermissionContextKey,
value: impl Into<String>,
) -> Result<(), PermissionRuleContextError>
pub fn add_custom_context( &mut self, key: PermissionContextKey, value: impl Into<String>, ) -> Result<(), PermissionRuleContextError>
Adds one custom active context in place.
§Errors
Returns an error for an empty value or a conflicting value for the same key.
Trait Implementations§
Source§impl Clone for PermissionContext
impl Clone for PermissionContext
Source§fn clone(&self) -> PermissionContext
fn clone(&self) -> PermissionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PermissionContext
impl Debug for PermissionContext
Source§impl Default for PermissionContext
impl Default for PermissionContext
Source§fn default() -> PermissionContext
fn default() -> PermissionContext
Returns the “default value” for a type. Read more
impl Eq for PermissionContext
Source§impl PartialEq for PermissionContext
impl PartialEq for PermissionContext
impl StructuralPartialEq for PermissionContext
Auto Trait Implementations§
impl Freeze for PermissionContext
impl RefUnwindSafe for PermissionContext
impl Send for PermissionContext
impl Sync for PermissionContext
impl Unpin for PermissionContext
impl UnsafeUnpin for PermissionContext
impl UnwindSafe for PermissionContext
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>