pub enum GridError {
InvalidDimensions {
width: usize,
height: usize,
},
InvalidByteLength {
expected_mod: usize,
actual_len: usize,
},
InvalidKeyLength {
expected_len: usize,
actual_len: usize,
},
}Expand description
Represents structured errors that can occur during Grid operations.
This enum replaces generic string errors to provide zero-allocation error handling and programmatic access to failure details. It is primarily used during Grid initialization and serialization.
Variants§
InvalidDimensions
Indicates that the requested Grid dimensions are invalid for cryptographic operations.
This error occurs when creating a new Grid if the dimensions do not allow for sufficient diffusion (e.g., width is 1, or total area is too small).
§Fields
width: The width (columns) of the attempted Grid.height: The height (rows) of the attempted Grid.
InvalidByteLength
Indicates that the input byte sequence length does not align with Grid requirements.
This error occurs during deserialization (e.g., from_bytes) when the provided
data length is not a multiple of the Grid’s total byte size ($W \times H \times 8$ bytes).
§Fields
expected_mod: The required modulus (block size in bytes).actual_len: The actual length of the provided byte vector.
InvalidKeyLength
Indicates that the provided raw key has an incorrect length.
The WHY2 key scheduling algorithm requires the input key vector to be exactly
twice the size of the Grid area ($2 \times W \times H$). This allows for the initial
folding and mixing of key parts (low and high components).
§Fields
expected_len: The required key length (number ofi64elements).actual_len: The length of the provided key vector.
Trait Implementations§
Source§impl Error for GridError
impl Error for GridError
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
impl StructuralPartialEq for GridError
Auto Trait Implementations§
impl Freeze for GridError
impl RefUnwindSafe for GridError
impl Send for GridError
impl Sync for GridError
impl Unpin for GridError
impl UnwindSafe for GridError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more