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 strexpected crate::visitor::FieldKind variant name, for instance “FieldKind::F64”
actual: StringDebug 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
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
impl VisitError
Sourcepub fn field_does_not_exist(name: &str, visitor: &Visitor) -> Self
pub fn field_does_not_exist(name: &str, visitor: &Visitor) -> Self
Create a VisitError::FieldDoesNotExist containing the given field name and the
breadcrumbs of the current visitor node.
Trait Implementations§
Source§impl Debug for VisitError
impl Debug for VisitError
Source§impl Display for VisitError
impl Display for VisitError
Source§impl Error for VisitError
impl Error for VisitError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<DecodeError> for VisitError
impl From<DecodeError> for VisitError
Source§fn from(value: DecodeError) -> Self
fn from(value: DecodeError) -> Self
Source§impl From<Error> for VisitError
impl From<Error> for VisitError
Source§impl From<Error> for VisitError
impl From<Error> for VisitError
Source§impl From<FileError> for VisitError
impl From<FileError> for VisitError
Source§impl From<FromUtf8Error> for VisitError
impl From<FromUtf8Error> for VisitError
Source§fn from(_: FromUtf8Error) -> Self
fn from(_: FromUtf8Error) -> Self
Source§impl From<ParseFloatError> for VisitError
impl From<ParseFloatError> for VisitError
Source§fn from(value: ParseFloatError) -> Self
fn from(value: ParseFloatError) -> Self
Source§impl From<ParseIntError> for VisitError
impl From<ParseIntError> for VisitError
Source§fn from(value: ParseIntError) -> Self
fn from(value: ParseIntError) -> Self
Source§impl<T> From<PoisonError<&mut T>> for VisitError
impl<T> From<PoisonError<&mut T>> for VisitError
Source§fn from(_: PoisonError<&mut T>) -> Self
fn from(_: PoisonError<&mut T>) -> Self
Source§impl<T> From<PoisonError<MutexGuard<'_, T>>> for VisitError
impl<T> From<PoisonError<MutexGuard<'_, T>>> for VisitError
Source§fn from(_: PoisonError<MutexGuard<'_, T>>) -> Self
fn from(_: PoisonError<MutexGuard<'_, T>>) -> Self
Source§impl<T> From<PoisonError<RwLockWriteGuard<'_, T>>> for VisitError
impl<T> From<PoisonError<RwLockWriteGuard<'_, T>>> for VisitError
Source§fn from(_: PoisonError<RwLockWriteGuard<'_, T>>) -> Self
fn from(_: PoisonError<RwLockWriteGuard<'_, T>>) -> Self
Auto Trait Implementations§
impl Freeze for VisitError
impl !RefUnwindSafe for VisitError
impl Send for VisitError
impl Sync for VisitError
impl Unpin for VisitError
impl !UnwindSafe for VisitError
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
Source§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.