pub(crate) struct CommandRequirement<S> {
predicate: Option<Arc<dyn Fn(&S) -> bool + Send + Sync>>,
kind: Option<CommandRequirementKind>,
}Expand description
A source predicate attached to a command node.
Fields§
§predicate: Option<Arc<dyn Fn(&S) -> bool + Send + Sync>>§kind: Option<CommandRequirementKind>Implementations§
Source§impl<S> CommandRequirement<S>
impl<S> CommandRequirement<S>
Creates a permission-backed requirement with stable identity.
Sourcepub(crate) fn contextual(
predicate: impl Fn(&S) -> bool + Send + Sync + 'static,
) -> Self
pub(crate) fn contextual( predicate: impl Fn(&S) -> bool + Send + Sync + 'static, ) -> Self
Creates a non-permission source requirement with stable identity.
Returns whether the client should treat this node as permission restricted.
pub(super) fn and(self, other: Self) -> Selfwhere
S: 'static,
pub(super) fn is_compatible_with(&self, other: &Self) -> bool
Trait Implementations§
Source§impl<S> Clone for CommandRequirement<S>
impl<S> Clone for CommandRequirement<S>
Auto Trait Implementations§
impl<S> !RefUnwindSafe for CommandRequirement<S>
impl<S> !UnwindSafe for CommandRequirement<S>
impl<S> Freeze for CommandRequirement<S>
impl<S> Send for CommandRequirement<S>
impl<S> Sync for CommandRequirement<S>
impl<S> Unpin for CommandRequirement<S>
impl<S> UnsafeUnpin for CommandRequirement<S>
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> 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<>>