pub(crate) struct CommandContext<S, R = BrigadierRuntime>where
R: CommandRuntime<S>,{
source: Arc<S>,
input: Arc<str>,
root: NodeId,
arguments: Arc<ParsedArguments<R::ArgumentValue>>,
executor: Option<Arc<R::Executor>>,
nodes: Arc<[ParsedCommandNode]>,
range: StringRange,
child: Option<Arc<Self>>,
modifier: Option<Arc<R::Modifier>>,
forks: bool,
}Expand description
Immutable parsed input supplied to commands and redirect modifiers.
Fields§
§source: Arc<S>§input: Arc<str>§root: NodeId§arguments: Arc<ParsedArguments<R::ArgumentValue>>§executor: Option<Arc<R::Executor>>§nodes: Arc<[ParsedCommandNode]>§range: StringRange§child: Option<Arc<Self>>§modifier: Option<Arc<R::Modifier>>§forks: boolImplementations§
Source§impl<S, R> CommandContext<S, R>where
R: CommandRuntime<S>,
impl<S, R> CommandContext<S, R>where
R: CommandRuntime<S>,
Sourcepub(crate) const fn root(&self) -> NodeId
pub(crate) const fn root(&self) -> NodeId
Returns the root at which this context segment began parsing.
Sourcepub(crate) fn nodes(&self) -> &[ParsedCommandNode]
pub(crate) fn nodes(&self) -> &[ParsedCommandNode]
Returns all nodes consumed by this context segment.
Sourcepub(crate) const fn range(&self) -> StringRange
pub(crate) const fn range(&self) -> StringRange
Returns the range covered by this context segment.
Sourcepub(crate) fn argument(
&self,
name: &str,
) -> Result<&R::ArgumentValue, CommandSyntaxError>
pub(crate) fn argument( &self, name: &str, ) -> Result<&R::ArgumentValue, CommandSyntaxError>
Returns a parsed runtime argument by name.
pub(super) const fn child_arc(&self) -> Option<&Arc<Self>>
pub(crate) fn executor(&self) -> Option<&R::Executor>
pub(crate) fn modifier(&self) -> Option<&R::Modifier>
pub(crate) const fn is_forked(&self) -> bool
pub(crate) fn copy_for(&self, source: Arc<S>) -> Self
Source§impl<S, R> CommandContext<S, R>
impl<S, R> CommandContext<S, R>
Sourcepub(crate) fn boolean(&self, name: &str) -> Result<bool, CommandSyntaxError>
pub(crate) fn boolean(&self, name: &str) -> Result<bool, CommandSyntaxError>
Returns a parsed boolean argument.
Sourcepub(crate) fn integer(&self, name: &str) -> Result<i32, CommandSyntaxError>
pub(crate) fn integer(&self, name: &str) -> Result<i32, CommandSyntaxError>
Returns a parsed integer argument.
Sourcepub(crate) fn long(&self, name: &str) -> Result<i64, CommandSyntaxError>
pub(crate) fn long(&self, name: &str) -> Result<i64, CommandSyntaxError>
Returns a parsed long argument.
Sourcepub(crate) fn float(&self, name: &str) -> Result<f32, CommandSyntaxError>
pub(crate) fn float(&self, name: &str) -> Result<f32, CommandSyntaxError>
Returns a parsed float argument.
Source§impl<S> CommandContext<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
impl<S> CommandContext<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
fn typed_argument<T: DowncastType>( &self, name: &str, ) -> Result<&T, CommandSyntaxError>
Sourcepub(crate) fn time(&self, name: &str) -> Result<i32, CommandSyntaxError>
pub(crate) fn time(&self, name: &str) -> Result<i32, CommandSyntaxError>
Returns a parsed Minecraft time argument in ticks.
Sourcepub(crate) fn coordinates(
&self,
name: &str,
) -> Result<Coordinates, CommandSyntaxError>
pub(crate) fn coordinates( &self, name: &str, ) -> Result<Coordinates, CommandSyntaxError>
Returns a parsed coordinate expression without resolving it early.
Sourcepub(crate) fn entity_anchor(
&self,
name: &str,
) -> Result<EntityAnchor, CommandSyntaxError>
pub(crate) fn entity_anchor( &self, name: &str, ) -> Result<EntityAnchor, CommandSyntaxError>
Returns a parsed entity position anchor.
pub(crate) fn swizzle( &self, name: &str, ) -> Result<CoordinateAxes, CommandSyntaxError>
pub(crate) fn heightmap( &self, name: &str, ) -> Result<HeightmapType, CommandSyntaxError>
pub(crate) fn score_holder_argument( &self, name: &str, ) -> Result<&ScoreHolderArgument, CommandSyntaxError>
pub(crate) fn objective_name( &self, name: &str, ) -> Result<&str, CommandSyntaxError>
pub(crate) fn int_range( &self, name: &str, ) -> Result<IntRange, CommandSyntaxError>
pub(crate) fn biome_or_tag( &self, name: &str, ) -> Result<&BiomeOrTag, CommandSyntaxError>
pub(crate) fn structure_or_tag_key( &self, name: &str, ) -> Result<&StructureOrTagKey, CommandSyntaxError>
pub(crate) fn block_predicate( &self, name: &str, ) -> Result<&BlockPredicate, CommandSyntaxError>
pub(crate) fn block_input( &self, name: &str, ) -> Result<&BlockInput, CommandSyntaxError>
Sourcepub(crate) fn domain(&self, name: &str) -> Result<&str, CommandSyntaxError>
pub(crate) fn domain(&self, name: &str) -> Result<&str, CommandSyntaxError>
Returns a configured Steel domain name.
pub(crate) fn world_argument( &self, name: &str, ) -> Result<&WorldArgument, CommandSyntaxError>
Sourcepub(crate) fn game_mode(
&self,
name: &str,
) -> Result<GameType, CommandSyntaxError>
pub(crate) fn game_mode( &self, name: &str, ) -> Result<GameType, CommandSyntaxError>
Returns a parsed vanilla game mode.
pub(crate) fn entity_type( &self, name: &str, ) -> Result<EntityTypeRef, CommandSyntaxError>
pub(crate) fn enchantment( &self, name: &str, ) -> Result<EnchantmentRef, CommandSyntaxError>
pub(crate) fn damage_type( &self, name: &str, ) -> Result<DamageTypeRef, CommandSyntaxError>
pub(crate) fn item_stack( &self, name: &str, ) -> Result<&ItemStack, CommandSyntaxError>
pub(crate) fn item_predicate( &self, name: &str, ) -> Result<&ItemPredicate, CommandSyntaxError>
pub(crate) fn text_component( &self, name: &str, ) -> Result<&TextComponent, CommandSyntaxError>
pub(crate) fn nbt_path( &self, name: &str, ) -> Result<&NbtPath, CommandSyntaxError>
pub(crate) fn identifier( &self, name: &str, ) -> Result<&Identifier, CommandSyntaxError>
pub(crate) fn world_clock( &self, name: &str, ) -> Result<WorldClockRef, CommandSyntaxError>
pub(crate) fn timeline( &self, name: &str, ) -> Result<TimelineRef, CommandSyntaxError>
pub(crate) fn entity_selector( &self, name: &str, ) -> Result<&EntitySelector, CommandSyntaxError>
pub(crate) fn game_profile_argument( &self, name: &str, ) -> Result<&GameProfileArgument, CommandSyntaxError>
pub(crate) fn permission_rule_expression( &self, name: &str, ) -> Result<&PermissionRuleExpression, CommandSyntaxError>
pub(crate) fn permission_metadata_expression( &self, name: &str, ) -> Result<&PermissionMetadataExpression, CommandSyntaxError>
pub(crate) fn permission_group( &self, name: &str, ) -> Result<&PermissionGroupName, CommandSyntaxError>
Source§impl CommandContext<CommandSource, SteelCommandRuntime>
impl CommandContext<CommandSource, SteelCommandRuntime>
pub(crate) fn score_holders( &self, name: &str, wildcard: ScoreHolderWildcard, ) -> Result<Vec<ScoreHolder>, CommandSyntaxError>
pub(crate) fn score_holder( &self, name: &str, ) -> Result<ScoreHolder, CommandSyntaxError>
pub(crate) fn optional_entities( &self, name: &str, ) -> Result<Vec<SharedEntity>, CommandSyntaxError>
pub(crate) fn entities( &self, name: &str, ) -> Result<Vec<SharedEntity>, CommandSyntaxError>
pub(crate) fn entity( &self, name: &str, ) -> Result<SharedEntity, CommandSyntaxError>
pub(crate) fn optional_players( &self, name: &str, ) -> Result<Vec<Arc<Player>>, CommandSyntaxError>
pub(crate) fn players( &self, name: &str, ) -> Result<Vec<Arc<Player>>, CommandSyntaxError>
pub(crate) fn player( &self, name: &str, ) -> Result<Arc<Player>, CommandSyntaxError>
Auto Trait Implementations§
impl<S, R> Freeze for CommandContext<S, R>
impl<S, R> RefUnwindSafe for CommandContext<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 CommandContext<S, R>
impl<S, R> Sync for CommandContext<S, R>
impl<S, R> Unpin for CommandContext<S, R>
impl<S, R> UnsafeUnpin for CommandContext<S, R>
impl<S, R> UnwindSafe for CommandContext<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
§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<>>