#[non_exhaustive]pub enum DeserializeError {
InsufficientData,
InvariantFailed(Cow<'static, str>),
LengthOverflow,
}Expand description
Error when deserializing data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InsufficientData
There is insufficient data in the buffer to deserialize the complete type.
InvariantFailed(Cow<'static, str>)
An invariant of the deserialized type wasn’t upheld.
LengthOverflow
Value of the length field exceeds usize::MAX.
Implementations§
Source§impl DeserializeError
impl DeserializeError
Sourcepub fn invariant(message: impl Into<Cow<'static, str>>) -> Self
pub fn invariant(message: impl Into<Cow<'static, str>>) -> Self
Creates a new DeserializeError::InvariantFailed with the given message.
§Examples
use rsomeip_bytes::DeserializeError;
// Can use static error messages.
let borrowed = DeserializeError::invariant("generic error");
assert_eq!(borrowed.to_string(), "invariant failed: generic error");
// Or dynamic error messages.
let owned = DeserializeError::invariant(format!("specific error: {}", 42));
assert_eq!(owned.to_string(), "invariant failed: specific error: 42");Trait Implementations§
Source§impl Clone for DeserializeError
impl Clone for DeserializeError
Source§fn clone(&self) -> DeserializeError
fn clone(&self) -> DeserializeError
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 DeserializeError
impl Debug for DeserializeError
Source§impl Display for DeserializeError
impl Display for DeserializeError
impl Eq for DeserializeError
Source§impl Error for DeserializeError
impl Error for DeserializeError
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 Hash for DeserializeError
impl Hash for DeserializeError
Source§impl PartialEq for DeserializeError
impl PartialEq for DeserializeError
impl StructuralPartialEq for DeserializeError
Auto Trait Implementations§
impl Freeze for DeserializeError
impl RefUnwindSafe for DeserializeError
impl Send for DeserializeError
impl Sync for DeserializeError
impl Unpin for DeserializeError
impl UnsafeUnpin for DeserializeError
impl UnwindSafe for DeserializeError
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