#[non_exhaustive]pub enum SerializeError {
BufferOverflow,
InvariantFailed(Cow<'static, str>),
LengthOverflow,
SizeMismatch,
SizeOverflow,
}Expand description
Error when serializing 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.
BufferOverflow
The target buffer doesn’t have enough capacity for self.
InvariantFailed(Cow<'static, str>)
An invariant of the serialized type wasn’t upheld.
LengthOverflow
Length exceeds the capacity of the length field.
SizeMismatch
Size of the serialized data doesn’t match value returned by Serialize::size.
SizeOverflow
Size exceeds the capacity of usize.
Implementations§
Source§impl SerializeError
impl SerializeError
Sourcepub fn invariant(message: impl Into<Cow<'static, str>>) -> Self
pub fn invariant(message: impl Into<Cow<'static, str>>) -> Self
Creates a new SerializeError::InvariantFailed with the given message.
§Examples
use rsomeip_bytes::SerializeError;
// Can use static error messages.
let borrowed = SerializeError::invariant("generic error");
assert_eq!(borrowed.to_string(), "invariant failed: generic error");
// Or dynamic error messages.
let owned = SerializeError::invariant(format!("specific error: {}", 42));
assert_eq!(owned.to_string(), "invariant failed: specific error: 42");Trait Implementations§
Source§impl Clone for SerializeError
impl Clone for SerializeError
Source§fn clone(&self) -> SerializeError
fn clone(&self) -> SerializeError
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 SerializeError
impl Debug for SerializeError
Source§impl Display for SerializeError
impl Display for SerializeError
impl Eq for SerializeError
Source§impl Error for SerializeError
impl Error for SerializeError
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 SerializeError
impl Hash for SerializeError
Source§impl PartialEq for SerializeError
impl PartialEq for SerializeError
impl StructuralPartialEq for SerializeError
Auto Trait Implementations§
impl Freeze for SerializeError
impl RefUnwindSafe for SerializeError
impl Send for SerializeError
impl Sync for SerializeError
impl Unpin for SerializeError
impl UnsafeUnpin for SerializeError
impl UnwindSafe for SerializeError
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