pub(crate) struct CommandDispatcherBuilder<S>where
S: CommandPermissionSource,{
registrations: Vec<CommandRegistration<S>>,
ids: FxHashSet<Identifier>,
declared_permissions: BTreeSet<PermissionKey>,
}Expand description
Collects declarations before atomically constructing a dispatcher.
Fields§
§registrations: Vec<CommandRegistration<S>>§ids: FxHashSet<Identifier>§declared_permissions: BTreeSet<PermissionKey>Implementations§
Source§impl<S> CommandDispatcherBuilder<S>where
S: CommandPermissionSource,
impl<S> CommandDispatcherBuilder<S>where
S: CommandPermissionSource,
pub(crate) fn new() -> Self
Sourcepub(crate) fn declare_permission(
&mut self,
permission: impl Into<String>,
) -> Result<(), CommandRegistrationError>
pub(crate) fn declare_permission( &mut self, permission: impl Into<String>, ) -> Result<(), CommandRegistrationError>
Declares a non-command permission for discovery and autocomplete.
Sourcepub(crate) fn register(
&mut self,
registration: CommandRegistration<S>,
) -> Result<(), CommandRegistrationError>
pub(crate) fn register( &mut self, registration: CommandRegistration<S>, ) -> Result<(), CommandRegistrationError>
Adds one declaration. Earlier declarations win unqualified collisions.
pub(crate) fn extend( &mut self, other: Self, ) -> Result<(), CommandRegistrationError>
Sourcepub(crate) fn build_with_permissions(
self,
) -> Result<RegisteredCommandDispatcher<S>, CommandRegistrationError>
pub(crate) fn build_with_permissions( self, ) -> Result<RegisteredCommandDispatcher<S>, CommandRegistrationError>
Builds the graph and retains permission keys for command autocomplete.
Trait Implementations§
Source§impl<S> Default for CommandDispatcherBuilder<S>where
S: CommandPermissionSource,
impl<S> Default for CommandDispatcherBuilder<S>where
S: CommandPermissionSource,
Auto Trait Implementations§
impl<S> !RefUnwindSafe for CommandDispatcherBuilder<S>
impl<S> !Sync for CommandDispatcherBuilder<S>
impl<S> !UnwindSafe for CommandDispatcherBuilder<S>
impl<S> Freeze for CommandDispatcherBuilder<S>
impl<S> Send for CommandDispatcherBuilder<S>
impl<S> Unpin for CommandDispatcherBuilder<S>
impl<S> UnsafeUnpin for CommandDispatcherBuilder<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
§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<>>