#[non_exhaustive]pub enum FromSliceError {
#[non_exhaustive] InvalidLength {
expected: usize,
got: usize,
},
}Expand description
Error returned when a byte slice cannot be converted to Fixed<[u8; N]> due to
length mismatch. Produced by Fixed::try_from(&[u8]).
Error returned when a byte slice cannot be converted to a fixed-size array.
Carries the expected and actual lengths in all build profiles. Lengths are public protocol parameters, not secret material.
Implements core::error::Error unconditionally — no std feature is
required, and the impl is present in no_std builds. (On the 0.8 line
this impl is std-gated, because core::error::Error needs Rust 1.81 and
that branch targets 1.70. Code that must build against both should not
assume the trait is available without std.)
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.
#[non_exhaustive]InvalidLength
The slice length does not match the target array length.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
Trait Implementations§
Source§impl Clone for FromSliceError
impl Clone for FromSliceError
impl Copy for FromSliceError
Source§impl Debug for FromSliceError
impl Debug for FromSliceError
Source§impl Display for FromSliceError
impl Display for FromSliceError
impl Eq for FromSliceError
Source§impl Error for FromSliceError
impl Error for FromSliceError
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 PartialEq for FromSliceError
impl PartialEq for FromSliceError
impl StructuralPartialEq for FromSliceError
Auto Trait Implementations§
impl Freeze for FromSliceError
impl RefUnwindSafe for FromSliceError
impl Send for FromSliceError
impl Sync for FromSliceError
impl Unpin for FromSliceError
impl UnsafeUnpin for FromSliceError
impl UnwindSafe for FromSliceError
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