pub(crate) struct CommandNodeBuilder<S, R = BrigadierRuntime>where
R: CommandRuntime<S>,{
data: CommandNodeData<R::Argument>,
children: Vec<Self>,
executor: Option<Arc<R::Executor>>,
requirement: CommandRequirement<S>,
execution_requirement: CommandRequirement<S>,
redirect: Option<CommandRedirect<S, R>>,
}Expand description
Builds one literal or argument command node and its descendants.
Fields§
§data: CommandNodeData<R::Argument>§children: Vec<Self>§executor: Option<Arc<R::Executor>>§requirement: CommandRequirement<S>§execution_requirement: CommandRequirement<S>§redirect: Option<CommandRedirect<S, R>>Implementations§
Source§impl<S, R> CommandNodeBuilder<S, R>where
R: CommandRuntime<S>,
impl<S, R> CommandNodeBuilder<S, R>where
R: CommandRuntime<S>,
Sourcepub(crate) fn literal(name: impl Into<Box<str>>) -> Self
pub(crate) fn literal(name: impl Into<Box<str>>) -> Self
Creates a literal for this runtime model.
Sourcepub(crate) fn argument(
name: impl Into<Box<str>>,
argument_type: R::Argument,
) -> Self
pub(crate) fn argument( name: impl Into<Box<str>>, argument_type: R::Argument, ) -> Self
Creates an argument for this runtime model.
Sourcepub(crate) fn literal_name(&self) -> Option<&str>
pub(crate) fn literal_name(&self) -> Option<&str>
Returns this node’s literal name, or None for an argument node.
Sourcepub(crate) fn with_literal_name(self, name: impl Into<Box<str>>) -> Option<Self>
pub(crate) fn with_literal_name(self, name: impl Into<Box<str>>) -> Option<Self>
Replaces this node’s literal name, returning None for an argument node.
Sourcepub(crate) fn then(self, child: Self) -> Self
pub(crate) fn then(self, child: Self) -> Self
Adds a child while preserving registration order.
Sourcepub(crate) fn executes_with_executor(self, executor: Arc<R::Executor>) -> Self
pub(crate) fn executes_with_executor(self, executor: Arc<R::Executor>) -> Self
Attaches an executor payload without interpreting it.
Sourcepub(crate) fn requires(self, requirement: CommandRequirement<S>) -> Self
pub(crate) fn requires(self, requirement: CommandRequirement<S>) -> Self
Replaces the allow-all requirement with requirement.
Sourcepub(crate) fn also_requires(self, requirement: CommandRequirement<S>) -> Selfwhere
S: 'static,
pub(crate) fn also_requires(self, requirement: CommandRequirement<S>) -> Selfwhere
S: 'static,
Adds a requirement while preserving any predicate already on this node.
Sourcepub(crate) fn also_requires_execution(
self,
requirement: CommandRequirement<S>,
) -> Selfwhere
S: 'static,
pub(crate) fn also_requires_execution(
self,
requirement: CommandRequirement<S>,
) -> Selfwhere
S: 'static,
Adds a requirement that applies only when this node’s executor is selected.
Sourcepub(crate) fn literal_path_match_count(&self, path: &[Box<str>]) -> usize
pub(crate) fn literal_path_match_count(&self, path: &[Box<str>]) -> usize
Returns the number of occurrences of one literal path below this node.
Argument nodes do not consume path segments.
Sourcepub(crate) fn apply_scoped_requirements(
&mut self,
scope_paths: &[Vec<Box<str>>],
requirements_for: impl FnMut(Option<usize>, &[usize]) -> CommandRequirementRoute<S>,
)where
S: 'static,
pub(crate) fn apply_scoped_requirements(
&mut self,
scope_paths: &[Vec<Box<str>>],
requirements_for: impl FnMut(Option<usize>, &[usize]) -> CommandRequirementRoute<S>,
)where
S: 'static,
Applies independently scoped requirements using literal-only paths.
A descendant scope may traverse its ancestors, but it cannot execute an ancestor unless the route’s governing requirement also permits it.
fn apply_scoped_requirements_inner<F>( &mut self, inherited_scope: Option<usize>, active: &[ActiveRequirementScope<'_>], parent_route: Option<&RequirementRouteKey>, cache: &mut Vec<(RequirementRouteKey, CommandRequirementRoute<S>)>, requirements_for: &mut F, )
Sourcepub(crate) fn redirects(self, target: impl Into<CommandRedirectTarget>) -> Self
pub(crate) fn redirects(self, target: impl Into<CommandRedirectTarget>) -> Self
Redirects parsing to an existing node without transforming the source.
Sourcepub(crate) fn redirects_with_modifier(
self,
target: impl Into<CommandRedirectTarget>,
modifier: Arc<R::Modifier>,
forks: bool,
) -> Self
pub(crate) fn redirects_with_modifier( self, target: impl Into<CommandRedirectTarget>, modifier: Arc<R::Modifier>, forks: bool, ) -> Self
Redirects with an opaque runtime modifier payload.
pub(super) fn normalize( self, ) -> Result<UnregisteredCommandNode<S, R>, RegistrationError>
Source§impl<S> CommandNodeBuilder<S, BrigadierRuntime>
impl<S> CommandNodeBuilder<S, BrigadierRuntime>
Sourcepub(crate) fn executes(
self,
executor: impl Fn(&CommandContext<S>) -> Result<i32, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn executes( self, executor: impl Fn(&CommandContext<S>) -> Result<i32, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Attaches a standard synchronous command callback.
Sourcepub(crate) fn redirects_with(
self,
target: NodeId,
modifier: impl Fn(&CommandContext<S>) -> Result<S, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn redirects_with( self, target: NodeId, modifier: impl Fn(&CommandContext<S>) -> Result<S, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Redirects parsing and transforms the source once before continuing.
Sourcepub(crate) fn forks(
self,
target: NodeId,
modifier: impl Fn(&CommandContext<S>) -> Result<Vec<S>, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn forks( self, target: NodeId, modifier: impl Fn(&CommandContext<S>) -> Result<Vec<S>, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Redirects parsing and expands one source into zero or more sources.
Source§impl<S> CommandNodeBuilder<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
impl<S> CommandNodeBuilder<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
Sourcepub(crate) fn executes(
self,
executor: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<i32, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn executes( self, executor: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<i32, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Attaches an ordinary synchronous executor.
Sourcepub(crate) fn executes_suspended<T>(
self,
executor: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<T, CommandSyntaxError> + Send + Sync + 'static,
) -> Selfwhere
T: CommandResultSuspension,
pub(crate) fn executes_suspended<T>(
self,
executor: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<T, CommandSyntaxError> + Send + Sync + 'static,
) -> Selfwhere
T: CommandResultSuspension,
Attaches an ordinary executor whose command result is produced across ticks.
Sourcepub(crate) fn executes_custom(
self,
executor: impl CustomCommandExecutor<S> + 'static,
) -> Self
pub(crate) fn executes_custom( self, executor: impl CustomCommandExecutor<S> + 'static, ) -> Self
Attaches an internal executor with frame and queue control.
Sourcepub(crate) fn redirects_with(
self,
target: impl Into<CommandRedirectTarget>,
modifier: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<S, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn redirects_with( self, target: impl Into<CommandRedirectTarget>, modifier: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<S, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Redirects parsing and transforms the source once before continuing.
Sourcepub(crate) fn forks(
self,
target: impl Into<CommandRedirectTarget>,
modifier: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<Vec<S>, CommandSyntaxError> + Send + Sync + 'static,
) -> Self
pub(crate) fn forks( self, target: impl Into<CommandRedirectTarget>, modifier: impl Fn(&CommandContext<S, SteelCommandRuntime>) -> Result<Vec<S>, CommandSyntaxError> + Send + Sync + 'static, ) -> Self
Redirects parsing and expands one source into zero or more sources.
Sourcepub(crate) fn redirects_custom(
self,
target: impl Into<CommandRedirectTarget>,
modifier: impl CustomModifierExecutor<S> + 'static,
forks: bool,
) -> Self
pub(crate) fn redirects_custom( self, target: impl Into<CommandRedirectTarget>, modifier: impl CustomModifierExecutor<S> + 'static, forks: bool, ) -> Self
Redirects with an internal modifier that controls frames or queued work.
Trait Implementations§
Auto Trait Implementations§
impl<S, R = BrigadierRuntime> !RefUnwindSafe for CommandNodeBuilder<S, R>
impl<S, R = BrigadierRuntime> !UnwindSafe for CommandNodeBuilder<S, R>
impl<S, R> Freeze for CommandNodeBuilder<S, R>
impl<S, R> Send for CommandNodeBuilder<S, R>
impl<S, R> Sync for CommandNodeBuilder<S, R>
impl<S, R> Unpin for CommandNodeBuilder<S, R>
impl<S, R> UnsafeUnpin for CommandNodeBuilder<S, R>
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
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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>