Struct scoop_hash::ChecksumBuilder
source · pub struct ChecksumBuilder { /* private fields */ }
Expand description
ChecksumBuilder is used to create a Checksum instance.
Implementations§
source§impl ChecksumBuilder
impl ChecksumBuilder
sourcepub fn new() -> ChecksumBuilder
pub fn new() -> ChecksumBuilder
Creates a new ChecksumBuilder instance.
Examples
use scoop_hash::ChecksumBuilder;
let mut md5 = ChecksumBuilder::new().md5().build();
md5.consume(b"hello world");
assert!(md5.check("5eb63bbbe01eeed093cb22bb8f5acdc3"));
sourcepub fn algo(self, algo: &str) -> Result<ChecksumBuilder, Error>
pub fn algo(self, algo: &str) -> Result<ChecksumBuilder, Error>
Use the specified hash algorithm.
Errors
Returns an error if the specified algorithm is not supported.
sourcepub fn md5(self) -> ChecksumBuilder
pub fn md5(self) -> ChecksumBuilder
Use the md5 hash algorithm.
sourcepub fn sha1(self) -> ChecksumBuilder
pub fn sha1(self) -> ChecksumBuilder
Use the sha1 hash algorithm.
sourcepub fn sha256(self) -> ChecksumBuilder
pub fn sha256(self) -> ChecksumBuilder
Use the sha256 hash algorithm.
sourcepub fn sha512(self) -> ChecksumBuilder
pub fn sha512(self) -> ChecksumBuilder
Use the sha512 hash algorithm.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ChecksumBuilder
impl !Send for ChecksumBuilder
impl !Sync for ChecksumBuilder
impl Unpin for ChecksumBuilder
impl !UnwindSafe for ChecksumBuilder
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