pub enum Md5Error {
ReadError(Error),
IOError(Error),
}Expand description
The error of a Md5Hasher operation.
Variants§
ReadError(Error)
Error while doing read from an input.
IOError(Error)
Other I/O errors. While the Md5Hasher don’t use this error, it allows to create ergonomic functions for hashing a std::io::Read object.
use std::fs::File;
use std::io::prelude::*;
use ya_md5::Md5Hasher;
use ya_md5::Hash;
use ya_md5::Md5Error;
fn hash_file() -> Result<Hash, Md5Error> {
std::fs::write("foo.txt", b"hello world")?;
let hash = {
let mut file = File::open("foo.txt")?;
Md5Hasher::hash(&mut file)?
};
std::fs::remove_file("foo.txt")?;
Ok(hash)
}
Trait Implementations§
Source§impl Error for Md5Error
impl Error for Md5Error
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()
Auto Trait Implementations§
impl Freeze for Md5Error
impl !RefUnwindSafe for Md5Error
impl Send for Md5Error
impl Sync for Md5Error
impl Unpin for Md5Error
impl !UnwindSafe for Md5Error
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