Struct ValidityError
pub struct ValidityError<Src, Dst: ?Sized + TryFromBytes> { /* private fields */ }
The error emitted if the conversion source contains invalid data.
Implementations
impl<Src, Dst: ?Sized + TryFromBytes> ValidityError<Src, Dst>
fn into_src(self) -> SrcProduces the source underlying the failed conversion.
fn map_src<NewSrc>(self, f: impl FnOnce(Src) -> NewSrc) -> ValidityError<NewSrc, Dst>Maps the source value associated with the conversion error.
This can help mitigate [issues with
Send,Syncand'staticbounds][self#send-sync-and-static].Examples
use *; let source: u8 = 42; // Try to transmute the `source` to a `bool`. This will fail. let maybe_bool: = try_transmute!; // Drop the error's source. let maybe_bool: = maybe_bool.map_err;
Trait Implementations
impl<Src, Dst> Display for ValidityError<Src, Dst>
where
Dst: KnownLayout + TryFromBytes + ?Sized,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<Src, Dst> Error for ValidityError<Src, Dst>
where
Dst: KnownLayout + TryFromBytes + ?Sized,
impl<Src, Dst: ?Sized + TryFromBytes> Debug for ValidityError<Src, Dst>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<Src: Clone, Dst: ?Sized + TryFromBytes> Clone for ValidityError<Src, Dst>
fn clone(&self) -> Self
impl<Src: Eq, Dst: ?Sized + TryFromBytes> Eq for ValidityError<Src, Dst>
impl<Src: PartialEq, Dst: ?Sized + TryFromBytes> PartialEq for ValidityError<Src, Dst>
fn eq(&self, other: &Self) -> bool
Auto Trait Implementations
impl<Src, Dst> Freeze for ValidityError<Src, Dst>
where
Src: Freeze,
SendSyncPhantomData<Dst>: Freeze,
Dst: ?Sized,
impl<Src, Dst> RefUnwindSafe for ValidityError<Src, Dst>
where
Src: RefUnwindSafe,
SendSyncPhantomData<Dst>: RefUnwindSafe,
Dst: ?Sized,
impl<Src, Dst> Send for ValidityError<Src, Dst>
where
Src: Send,
SendSyncPhantomData<Dst>: Send,
Dst: ?Sized,
impl<Src, Dst> Sync for ValidityError<Src, Dst>
where
Src: Sync,
SendSyncPhantomData<Dst>: Sync,
Dst: ?Sized,
impl<Src, Dst> Unpin for ValidityError<Src, Dst>
where
Src: Unpin,
SendSyncPhantomData<Dst>: Unpin,
Dst: ?Sized,
impl<Src, Dst> UnsafeUnpin for ValidityError<Src, Dst>
where
Src: UnsafeUnpin,
SendSyncPhantomData<Dst>: UnsafeUnpin,
Dst: ?Sized,
impl<Src, Dst> UnwindSafe for ValidityError<Src, Dst>
where
Src: UnwindSafe,
SendSyncPhantomData<Dst>: UnwindSafe,
Dst: ?Sized,
Blanket Implementations
impl<T> Any for ValidityError<Src, Dst>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ValidityError<Src, Dst>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ValidityError<Src, Dst>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ValidityError<Src, Dst>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ValidityError<Src, Dst>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for ValidityError<Src, Dst>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ValidityError<Src, Dst>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ValidityError<Src, Dst>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>