Skip to main content

Arg

Enum Arg 

Source
pub enum Arg {
Show 19 variants Boolean, Double, Integer, String, Entity, GameProfile, BlockPos, ColumnPos, Vec3, Vec2, BlockState, ItemStack, Message, Component, ResourceLocation, Uuid, Rotation, Options(Vec<String>), Player,
}
Expand description

Argument type for a command parameter.

Determines how the argument is parsed, validated, and presented in client-side tab-completion (Brigadier tree).

Variants§

§

Boolean

Boolean (true/false). Parser ID 0.

§

Double

64-bit floating point number. Parser ID 2.

§

Integer

64-bit integer. Parser ID 3.

§

String

Free-form single-word string. Parser ID 5, mode SINGLE_WORD.

§

Entity

Entity selector (@a, @p, @r, @e, @s) or player name. Parser ID 6.

§

GameProfile

Game profile (player name with tab-completion). Parser ID 7.

§

BlockPos

Block position (integer coordinates, supports ~). Parser ID 42.

§

ColumnPos

Column position (x z integers). Parser ID 43.

§

Vec3

3D coordinates (supports ~ and ^). Parser ID 40.

§

Vec2

2D coordinates (x z, supports ~ and ^). Parser ID 41.

§

BlockState

Block state (e.g., stone, oak_planks[axis=x]). Parser ID 44.

§

ItemStack

Item stack (e.g., diamond_sword{Damage:10}). Parser ID 46.

§

Message

Chat message (like GreedyString but with @mention support). Parser ID 48.

§

Component

JSON text component. Parser ID 10.

§

ResourceLocation

Resource location (namespace:path). Parser ID 35.

§

Uuid

UUID. Parser ID 11.

§

Rotation

Yaw and pitch rotation. Parser ID 39.

§

Options(Vec<String>)

Fixed set of choices with tab-completion. Uses string parser with minecraft:ask_server suggestions.

§

Player

Player name — tab-completes with connected player names. Uses minecraft:game_profile parser (ID 7).

Implementations§

Source§

impl Arg

Source

pub fn token_count(&self) -> usize

Returns how many tokens this argument type consumes.

Vec3 and BlockPos consume 3 tokens, Vec2/ColumnPos/Rotation consume 2, Message is greedy (0 means “consume all remaining”), everything else is 1.

Trait Implementations§

Source§

impl Clone for Arg

Source§

fn clone(&self) -> Arg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Arg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Arg

§

impl RefUnwindSafe for Arg

§

impl Send for Arg

§

impl Sync for Arg

§

impl Unpin for Arg

§

impl UnsafeUnpin for Arg

§

impl UnwindSafe for Arg

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.