#[non_exhaustive]pub enum GeneratorError {
FixedSizeMismatch,
FixedSizeTooLarge,
InputSizeTooLarge,
OutputOverflow,
}
Expand description
The error type representing an invalid or an unsupported operation of the generator.
§Compatibility Note
Since the version 0.3, the representation of this enum is no longer specified as specific representation of this enum is not important.
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.
FixedSizeMismatch
The fixed size has a mismatch with either the previously set value or the final input size.
FixedSizeTooLarge
InputSizeTooLarge
The total input size on finalization is too large.
OutputOverflow
The output would cause a buffer overflow for a specific output type.
This error only occurs when:
- Truncation is disabled,
- The output type is a short form
(because of those conditions, it only occurs on a rawGenerator::finalize_raw()
call) and - The resulting block hash 2 is longer than that of the
short form limit (
block_hash::HALF_SIZE
).
Implementations§
Source§impl GeneratorError
impl GeneratorError
Sourcepub fn is_size_too_large_error(&self) -> bool
pub fn is_size_too_large_error(&self) -> bool
Checks whether this error is raised by one of the “size too large” cases.
It returns true
on either FixedSizeTooLarge
or InputSizeTooLarge
variants.
Trait Implementations§
Source§impl Clone for GeneratorError
impl Clone for GeneratorError
Source§fn clone(&self) -> GeneratorError
fn clone(&self) -> GeneratorError
Returns a duplicate of the value. Read more
1.0.0 · 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 GeneratorError
impl Debug for GeneratorError
Source§impl Display for GeneratorError
impl Display for GeneratorError
Source§impl Error for GeneratorError
impl Error for GeneratorError
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 From<GeneratorError> for GeneratorOrIOError
Available on crate features std
and easy-functions
only.
impl From<GeneratorError> for GeneratorOrIOError
Available on crate features
std
and easy-functions
only.Source§fn from(value: GeneratorError) -> Self
fn from(value: GeneratorError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for GeneratorError
impl PartialEq for GeneratorError
impl Copy for GeneratorError
impl Eq for GeneratorError
impl StructuralPartialEq for GeneratorError
Auto Trait Implementations§
impl Freeze for GeneratorError
impl RefUnwindSafe for GeneratorError
impl Send for GeneratorError
impl Sync for GeneratorError
impl Unpin for GeneratorError
impl UnwindSafe for GeneratorError
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