pub enum PermissionRuleContext {
Global,
Domain(PermissionDomain),
World(Identifier),
Custom {
key: PermissionContextKey,
value: PermissionContextValue,
},
All(PermissionRuleContexts),
}Expand description
Rule-side context in which a permission entry applies.
Variants§
Global
Applies in every runtime context.
Domain(PermissionDomain)
Applies within one server domain.
World(Identifier)
Applies within one loaded world.
Custom
Applies when a subsystem-provided key has one value.
Fields
§
key: PermissionContextKeyContext key owned by Steel or a future plugin.
§
value: PermissionContextValueRequired active value.
All(PermissionRuleContexts)
Applies when every nested context matches.
Implementations§
Source§impl PermissionRuleContext
impl PermissionRuleContext
Sourcepub fn domain(
domain: impl Into<String>,
) -> Result<Self, PermissionRuleContextError>
pub fn domain( domain: impl Into<String>, ) -> Result<Self, PermissionRuleContextError>
Creates a domain-scoped rule context.
Sourcepub const fn world(world: Identifier) -> Self
pub const fn world(world: Identifier) -> Self
Creates a loaded-world rule context.
Sourcepub fn custom(
key: PermissionContextKey,
value: impl Into<String>,
) -> Result<Self, PermissionRuleContextError>
pub fn custom( key: PermissionContextKey, value: impl Into<String>, ) -> Result<Self, PermissionRuleContextError>
Sourcepub fn all(
contexts: impl IntoIterator<Item = Self>,
) -> Result<Self, PermissionRuleContextError>
pub fn all( contexts: impl IntoIterator<Item = Self>, ) -> Result<Self, PermissionRuleContextError>
Creates a canonical AND-chain of rule contexts.
Global entries are omitted, nested chains are flattened, and duplicate values are idempotent. Conflicting values for one context key are rejected.
§Errors
Returns an error when a built-in or custom key receives multiple values.
pub(super) fn matches(&self, context: &PermissionContext) -> bool
pub(super) fn specificity(&self) -> usize
Trait Implementations§
Source§impl Clone for PermissionRuleContext
impl Clone for PermissionRuleContext
Source§fn clone(&self) -> PermissionRuleContext
fn clone(&self) -> PermissionRuleContext
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 PermissionRuleContext
impl Debug for PermissionRuleContext
Source§impl Display for PermissionRuleContext
impl Display for PermissionRuleContext
impl Eq for PermissionRuleContext
Source§impl Hash for PermissionRuleContext
impl Hash for PermissionRuleContext
Source§impl PartialEq for PermissionRuleContext
impl PartialEq for PermissionRuleContext
impl StructuralPartialEq for PermissionRuleContext
Auto Trait Implementations§
impl Freeze for PermissionRuleContext
impl RefUnwindSafe for PermissionRuleContext
impl Send for PermissionRuleContext
impl Sync for PermissionRuleContext
impl Unpin for PermissionRuleContext
impl UnsafeUnpin for PermissionRuleContext
impl UnwindSafe for PermissionRuleContext
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<>>