Skip to main content

VisitError

Enum VisitError 

Source
pub enum VisitError {
Show 23 variants Multiple(Vec<VisitError>), Io(Error), UnknownFieldType(u8), FieldDoesNotExist(String), FieldAlreadyExists(String), RegionAlreadyExists(String), InvalidCurrentNode, FieldTypeDoesNotMatch { expected: &'static str, actual: String, }, RegionDoesNotExist(String), NoActiveNode, NotSupportedFormat, InvalidName, TypeMismatch { expected: &'static str, actual: &'static str, }, RefCellAlreadyMutableBorrowed, User(String), UnexpectedRcNullIndex, PoisonedMutex, FileLoadError(FileError), ParseIntError(ParseIntError), ParseFloatError(ParseFloatError), DecodeError(DecodeError), UuidError(Error), Any(Box<dyn Error + Send + Sync>),
}
Expand description

Errors that may occur while reading or writing crate::visitor::Visitor.

Variants§

§

Multiple(Vec<VisitError>)

An error that occured for multiple reasons, when there are multiple potential ways to visit a node, and all of them lead to errors.

§

Io(Error)

An std::io::Error occured while reading or writing a file with Visitor data.

§

UnknownFieldType(u8)

When a field is encoded as bytes, the field data is prefixed by an identifying byte to allow the bytes to be decoded. This error happens when an identifying byte is expected during decoding, but an unknown value is found in that byte.

§

FieldDoesNotExist(String)

Attempting to visit a field on a read-mode Visitor when no field in the visitor data has the given name.

§

FieldAlreadyExists(String)

Attempting to visit a field on a write-mode Visitor when a field already has the given name.

§

RegionAlreadyExists(String)

Attempting to enter a region on a write-mode Visitor when a region already has the given name.

§

InvalidCurrentNode

Current node handle is invalid and does not lead to a real node.

§

FieldTypeDoesNotMatch

Attempting to visit a field using a read-mode Visitor when that field was originally written using a value of a different type.

Fields

§expected: &'static str

expected crate::visitor::FieldKind variant name, for instance “FieldKind::F64”

§actual: String

Debug representation of actual crate::visitor::FieldKind

§

RegionDoesNotExist(String)

Attempting to enter a region on a read-mode Visitor when no region in the visitor’s data has the given name.

§

NoActiveNode

The Visitor tried to leave is current node, but somehow it had no current node. This should never happen.

§

NotSupportedFormat

The crate::Visitor::MAGIC_BINARY_CURRENT, crate::Visitor::MAGIC_ASCII_CURRENT. bytes were missing from the beginning of encoded Visitor data.

§

InvalidName

Some sequence of bytes was not in UTF8 format.

§

TypeMismatch

Visitor data can be self-referential, such as when the data contains multiple Rc references to a single shared value. This causes the visitor to store the data once and then later references to the same value point back to its first occurrence. This error occurs if one of these references points to a value of the wrong type.

Fields

§expected: &'static str

The type that was visiting when the error occurred.

§actual: &'static str

The type that was stored in the Rc or Arc.

§

RefCellAlreadyMutableBorrowed

Attempting to visit a mutably borrowed RefCell.

§

User(String)

A plain-text error message that could indicate almost anything.

§

UnexpectedRcNullIndex

Rc and Arc values store an “Id” value in the Visitor data which is based in their internal pointer. This error indicates that while reading this data, one of those Id values was discovered by be 0.

§

PoisonedMutex

A poison error occurred while trying to visit a mutex.

§

FileLoadError(FileError)

A FileLoadError was encountered while trying to decode Visitor data from a file.

§

ParseIntError(ParseIntError)

Integer parsing error.

§

ParseFloatError(ParseFloatError)

Floating point number parsing error.

§

DecodeError(DecodeError)

An error occurred when trying to decode base64-encoded data.

§

UuidError(Error)

An error occurred when trying to parse uuid from a string.

§

Any(Box<dyn Error + Send + Sync>)

Arbitrary error.

Implementations§

Source§

impl VisitError

Source

pub fn field_does_not_exist(name: &str, visitor: &Visitor) -> VisitError

Create a VisitError::FieldDoesNotExist containing the given field name and the breadcrumbs of the current visitor node.

Source

pub fn multiple(self, other: VisitError) -> VisitError

Create an error from two errors.

Trait Implementations§

Source§

impl Debug for VisitError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for VisitError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for VisitError

1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Box<dyn Error + Send + Sync>> for VisitError

Source§

fn from(value: Box<dyn Error + Send + Sync>) -> VisitError

Converts to this type from the input type.
Source§

impl From<DecodeError> for VisitError

Source§

fn from(value: DecodeError) -> VisitError

Converts to this type from the input type.
Source§

impl From<Error> for VisitError

Source§

fn from(io_err: Error) -> VisitError

Converts to this type from the input type.
Source§

impl From<Error> for VisitError

Source§

fn from(value: Error) -> VisitError

Converts to this type from the input type.
Source§

impl From<FileError> for VisitError

Source§

fn from(e: FileError) -> VisitError

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for VisitError

Source§

fn from(_: FromUtf8Error) -> VisitError

Converts to this type from the input type.
Source§

impl From<ParseFloatError> for VisitError

Source§

fn from(value: ParseFloatError) -> VisitError

Converts to this type from the input type.
Source§

impl From<ParseIntError> for VisitError

Source§

fn from(value: ParseIntError) -> VisitError

Converts to this type from the input type.
Source§

impl<T> From<PoisonError<&mut T>> for VisitError

Source§

fn from(_: PoisonError<&mut T>) -> VisitError

Converts to this type from the input type.
Source§

impl<T> From<PoisonError<MutexGuard<'_, T>>> for VisitError

Source§

fn from(_: PoisonError<MutexGuard<'_, T>>) -> VisitError

Converts to this type from the input type.
Source§

impl<T> From<PoisonError<RwLockWriteGuard<'_, T>>> for VisitError

Source§

fn from(_: PoisonError<RwLockWriteGuard<'_, T>>) -> VisitError

Converts to this type from the input type.
Source§

impl From<String> for VisitError

Source§

fn from(s: String) -> VisitError

Converts to this type from the input type.
Source§

impl From<VisitError> for CurveResourceError

Source§

fn from(e: VisitError) -> Self

Converts to this type from the input type.
Source§

impl From<VisitError> for GameError

Source§

fn from(value: VisitError) -> Self

Converts to this type from the input type.
Source§

impl From<VisitError> for MaterialError

Source§

fn from(value: VisitError) -> MaterialError

Converts to this type from the input type.
Source§

impl From<VisitError> for ModelLoadError

Source§

fn from(e: VisitError) -> Self

Converts to this type from the input type.
Source§

impl From<VisitError> for StyleResourceError

Source§

fn from(e: VisitError) -> StyleResourceError

Converts to this type from the input type.
Source§

impl From<VisitError> for TileMapBrushResourceError

Source§

fn from(e: VisitError) -> Self

Converts to this type from the input type.
Source§

impl From<VisitError> for TileSetResourceError

Source§

fn from(e: VisitError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> AsyncTaskResult for T
where T: Any + Send + 'static,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ObjectOrVariant<T> for U

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ResourceLoadError for T
where T: 'static + Debug + Display + Send + Sync,