pub(crate) struct ContextChain<S, R = BrigadierRuntime>where
R: CommandRuntime<S>,{
contexts: Arc<[Arc<CommandContext<S, R>>]>,
position: usize,
}Expand description
A flattened sequence of redirect contexts followed by one executable context.
Fields§
§contexts: Arc<[Arc<CommandContext<S, R>>]>§position: usizeImplementations§
Source§impl<S, R> ContextChain<S, R>where
R: CommandRuntime<S>,
impl<S, R> ContextChain<S, R>where
R: CommandRuntime<S>,
pub(super) fn try_flatten(root: Arc<CommandContext<S, R>>) -> Option<Self>
Sourcepub(crate) fn stage(&self) -> ContextChainStage
pub(crate) fn stage(&self) -> ContextChainStage
Returns the kind of work represented by the current stage.
Sourcepub(crate) fn top_context(&self) -> &CommandContext<S, R>
pub(crate) fn top_context(&self) -> &CommandContext<S, R>
Returns the parsed context at the current stage.
Sourcepub(crate) fn next_stage(&self) -> Option<Self>
pub(crate) fn next_stage(&self) -> Option<Self>
Advances to the next redirect or executable stage.
Source§impl<S> ContextChain<S, BrigadierRuntime>
impl<S> ContextChain<S, BrigadierRuntime>
Sourcepub(crate) fn run_modifier(
&self,
source: Arc<S>,
consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32),
forked: bool,
) -> Result<Vec<Arc<S>>, CommandSyntaxError>
pub(crate) fn run_modifier( &self, source: Arc<S>, consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32), forked: bool, ) -> Result<Vec<Arc<S>>, CommandSyntaxError>
Applies the current stage’s source modifier.
Sourcepub(crate) fn run_executable(
&self,
source: Arc<S>,
consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32),
forked: bool,
) -> Result<i32, CommandSyntaxError>
pub(crate) fn run_executable( &self, source: Arc<S>, consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32), forked: bool, ) -> Result<i32, CommandSyntaxError>
Runs the current stage’s terminal command.
Sourcepub(crate) fn execute_all(
&self,
source: S,
consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32),
) -> Result<i32, CommandSyntaxError>
pub(crate) fn execute_all( &self, source: S, consumer: &dyn Fn(&CommandContext<S, BrigadierRuntime>, bool, i32), ) -> Result<i32, CommandSyntaxError>
Executes the complete chain with Brigadier’s synchronous semantics.
Trait Implementations§
Source§impl<S, R> Clone for ContextChain<S, R>where
R: CommandRuntime<S>,
impl<S, R> Clone for ContextChain<S, R>where
R: CommandRuntime<S>,
Auto Trait Implementations§
impl<S, R> Freeze for ContextChain<S, R>
impl<S, R> RefUnwindSafe for ContextChain<S, R>where
S: RefUnwindSafe,
<R as CommandRuntime<S>>::Executor: RefUnwindSafe,
<R as CommandRuntime<S>>::Modifier: RefUnwindSafe,
<R as CommandRuntime<S>>::ArgumentValue: RefUnwindSafe,
impl<S, R> Send for ContextChain<S, R>
impl<S, R> Sync for ContextChain<S, R>
impl<S, R> Unpin for ContextChain<S, R>
impl<S, R> UnsafeUnpin for ContextChain<S, R>
impl<S, R> UnwindSafe for ContextChain<S, R>where
S: RefUnwindSafe,
<R as CommandRuntime<S>>::Executor: RefUnwindSafe,
<R as CommandRuntime<S>>::Modifier: RefUnwindSafe,
<R as CommandRuntime<S>>::ArgumentValue: RefUnwindSafe,
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<>>