pub struct CommandReader<'reader, 'input> {
inner: &'reader mut StringReader<'input>,
}Expand description
Cursor-aware input available to custom argument parsers.
Fields§
§inner: &'reader mut StringReader<'input>Implementations§
Source§impl<'input> CommandReader<'_, 'input>
impl<'input> CommandReader<'_, 'input>
Sourcepub fn skip_whitespace(&mut self)
pub fn skip_whitespace(&mut self)
Consumes Java-compatible command whitespace.
Sourcepub fn read_unquoted_string(&mut self) -> &'input str
pub fn read_unquoted_string(&mut self) -> &'input str
Reads one unquoted Brigadier string.
Sourcepub fn read_string(&mut self) -> Result<String, CommandError>
pub fn read_string(&mut self) -> Result<String, CommandError>
Reads one quoted or unquoted Brigadier string.
Sourcepub fn read_integer(&mut self) -> Result<i32, CommandError>
pub fn read_integer(&mut self) -> Result<i32, CommandError>
Reads a signed 32-bit integer.
Sourcepub fn read_long(&mut self) -> Result<i64, CommandError>
pub fn read_long(&mut self) -> Result<i64, CommandError>
Reads a signed 64-bit integer.
Sourcepub fn read_float(&mut self) -> Result<f32, CommandError>
pub fn read_float(&mut self) -> Result<f32, CommandError>
Reads a 32-bit floating-point value.
Sourcepub fn read_double(&mut self) -> Result<f64, CommandError>
pub fn read_double(&mut self) -> Result<f64, CommandError>
Reads a 64-bit floating-point value.
Sourcepub fn read_boolean(&mut self) -> Result<bool, CommandError>
pub fn read_boolean(&mut self) -> Result<bool, CommandError>
Reads a lowercase boolean.
Sourcepub fn expect(&mut self, expected: char) -> Result<(), CommandError>
pub fn expect(&mut self, expected: char) -> Result<(), CommandError>
Consumes one required symbol.
Sourcepub const fn checkpoint(&self) -> CommandReaderCursor
pub const fn checkpoint(&self) -> CommandReaderCursor
Captures the current cursor for speculative parsing.
Sourcepub const fn restore(&mut self, checkpoint: CommandReaderCursor)
pub const fn restore(&mut self, checkpoint: CommandReaderCursor)
Restores a previously captured cursor.
Sourcepub fn error(&self, message: impl Into<TextComponent>) -> CommandError
pub fn error(&self, message: impl Into<TextComponent>) -> CommandError
Creates an error carrying the reader’s current Brigadier context.
Auto Trait Implementations§
impl<'reader, 'input> !UnwindSafe for CommandReader<'reader, 'input>
impl<'reader, 'input> Freeze for CommandReader<'reader, 'input>
impl<'reader, 'input> RefUnwindSafe for CommandReader<'reader, 'input>
impl<'reader, 'input> Send for CommandReader<'reader, 'input>
impl<'reader, 'input> Sync for CommandReader<'reader, 'input>
impl<'reader, 'input> Unpin for CommandReader<'reader, 'input>
impl<'reader, 'input> UnsafeUnpin for CommandReader<'reader, 'input>
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<>>