pub(crate) struct ParsedCommandContext<S, R = BrigadierRuntime>where
R: CommandRuntime<S>,{
source: Arc<S>,
root: NodeId,
arguments: ParsedArguments<R::ArgumentValue>,
executor: Option<Arc<R::Executor>>,
nodes: Vec<ParsedCommandNode>,
range: StringRange,
child: Option<Box<Self>>,
modifier: Option<Arc<R::Modifier>>,
forks: bool,
}Expand description
The successful portion of one command parse branch.
Fields§
§source: Arc<S>§root: NodeId§arguments: ParsedArguments<R::ArgumentValue>§executor: Option<Arc<R::Executor>>§nodes: Vec<ParsedCommandNode>§range: StringRange§child: Option<Box<Self>>§modifier: Option<Arc<R::Modifier>>§forks: boolImplementations§
Source§impl<S, R> ParsedCommandContext<S, R>where
R: CommandRuntime<S>,
impl<S, R> ParsedCommandContext<S, R>where
R: CommandRuntime<S>,
pub(super) fn new(source: Arc<S>, root: NodeId, start: usize) -> Self
pub(super) fn branch(&self) -> Self
pub(super) fn source(&self) -> &S
pub(super) fn argument_suggestion_context( &self, ) -> ArgumentSuggestionContext<'_, S, R::ArgumentValue>
pub(super) const fn root(&self) -> NodeId
pub(super) const fn source_arc(&self) -> &Arc<S> ⓘ
pub(super) fn set_executor(&mut self, executor: Option<Arc<R::Executor>>)
pub(super) fn with_node( &mut self, node: NodeId, range: StringRange, redirect: Option<&CommandRedirect<S, R>>, )
pub(super) fn with_argument( &mut self, name: &str, range: StringRange, value: R::ArgumentValue, )
pub(super) fn set_child(&mut self, child: Self)
pub(super) fn build(self, input: Arc<str>) -> Arc<CommandContext<S, R>> ⓘ
pub(super) fn find_suggestion_context( &self, cursor: usize, ) -> Option<SuggestionContext<'_, S, R>>
Sourcepub(crate) fn nodes(&self) -> &[ParsedCommandNode]
pub(crate) fn nodes(&self) -> &[ParsedCommandNode]
Returns all nodes consumed by this parse segment.
Sourcepub(crate) const fn range(&self) -> StringRange
pub(crate) const fn range(&self) -> StringRange
Returns the range covered by this parse segment.
Sourcepub(crate) const fn is_executable(&self) -> bool
pub(crate) const fn is_executable(&self) -> bool
Returns whether the last parsed node has a command callback.
Sourcepub(crate) fn argument(&self, name: &str) -> Option<&R::ArgumentValue>
pub(crate) fn argument(&self, name: &str) -> Option<&R::ArgumentValue>
Returns a parsed runtime argument by name.
Source§impl<S, R> ParsedCommandContext<S, R>
impl<S, R> ParsedCommandContext<S, R>
Auto Trait Implementations§
impl<S, R> Freeze for ParsedCommandContext<S, R>
impl<S, R> RefUnwindSafe for ParsedCommandContext<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 ParsedCommandContext<S, R>
impl<S, R> Sync for ParsedCommandContext<S, R>
impl<S, R> Unpin for ParsedCommandContext<S, R>
impl<S, R> UnsafeUnpin for ParsedCommandContext<S, R>
impl<S, R> UnwindSafe for ParsedCommandContext<S, R>where
S: RefUnwindSafe,
<R as CommandRuntime<S>>::Executor: RefUnwindSafe,
<R as CommandRuntime<S>>::Modifier: RefUnwindSafe,
<R as CommandRuntime<S>>::ArgumentValue: UnwindSafe,
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<>>