pub(crate) struct CommandSyntaxError {
kind: CommandSyntaxErrorKind,
context: Option<CommandErrorContext>,
}Expand description
A Brigadier-compatible parsing error with input context.
Dynamic floating-point values use Rust’s standard display formatting; parsing and bounds behavior remain Brigadier-compatible.
Fields§
§kind: CommandSyntaxErrorKind§context: Option<CommandErrorContext>Implementations§
Source§impl CommandSyntaxError
impl CommandSyntaxError
pub(super) fn new( kind: CommandSyntaxErrorKind, input: &str, cursor: usize, byte_cursor: usize, ) -> Self
Sourcepub(crate) fn dynamic(message: impl Into<TextComponent>) -> Self
pub(crate) fn dynamic(message: impl Into<TextComponent>) -> Self
Creates a runtime command failure without parser input context.
Sourcepub(crate) const fn kind(&self) -> &CommandSyntaxErrorKind
pub(crate) const fn kind(&self) -> &CommandSyntaxErrorKind
Returns the specific built-in error.
Sourcepub(crate) const fn cursor(&self) -> Option<usize>
pub(crate) const fn cursor(&self) -> Option<usize>
Returns the failure position in UTF-16 code units.
Sourcepub(crate) fn raw_message(&self) -> String
pub(crate) fn raw_message(&self) -> String
Returns the error message without input context.
Sourcepub(crate) fn message_component(&self) -> TextComponent
pub(crate) fn message_component(&self) -> TextComponent
Returns the vanilla translatable component for this error.
Sourcepub(crate) fn context_component(&self) -> Option<TextComponent>
pub(crate) fn context_component(&self) -> Option<TextComponent>
Builds vanilla’s styled, clickable parser-context line.
Trait Implementations§
Source§impl Clone for CommandSyntaxError
impl Clone for CommandSyntaxError
Source§fn clone(&self) -> CommandSyntaxError
fn clone(&self) -> CommandSyntaxError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandSyntaxError
impl Debug for CommandSyntaxError
Source§impl Display for CommandSyntaxError
impl Display for CommandSyntaxError
Source§impl Error for CommandSyntaxError
impl Error for CommandSyntaxError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<CommandSyntaxError> for CommandError
impl From<CommandSyntaxError> for CommandError
Source§fn from(inner: CommandSyntaxError) -> Self
fn from(inner: CommandSyntaxError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for CommandSyntaxError
impl PartialEq for CommandSyntaxError
impl StructuralPartialEq for CommandSyntaxError
Auto Trait Implementations§
impl Freeze for CommandSyntaxError
impl RefUnwindSafe for CommandSyntaxError
impl Send for CommandSyntaxError
impl Sync for CommandSyntaxError
impl Unpin for CommandSyntaxError
impl UnsafeUnpin for CommandSyntaxError
impl UnwindSafe for CommandSyntaxError
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<>>