[−][src]Struct iocutil::contenthash::ContentHash
hash bundle for a content
Fields
sha256: SampleHash
sha1: SampleHash
md5: SampleHash
Methods
impl ContentHash
[src]
pub fn new(
sha256: impl TryInto<SampleHash>,
sha1: impl TryInto<SampleHash>,
md5: impl TryInto<SampleHash>
) -> Result<Self, Error>
[src]
sha256: impl TryInto<SampleHash>,
sha1: impl TryInto<SampleHash>,
md5: impl TryInto<SampleHash>
) -> Result<Self, Error>
create new object manually (not recommened)
Example
use iocutil::prelude::*; let x = ContentHash::new( "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "da39a3ee5e6b4b0d3255bfef95601890afd80709", "d41d8cd98f00b204e9800998ecf8427e" ).unwrap(); assert_eq!(x, ContentHash::default()); let y = ContentHash::new("a", "b", "c"); assert!(y.is_err()); let z = ContentHash::new( "da39a3ee5e6b4b0d3255bfef95601890afd80709", "d41d8cd98f00b204e9800998ecf8427e", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ); assert!(z.is_err());
pub fn of_file(path: impl AsRef<Path>) -> Result<Self, Error>
[src]
content hash of file
Example
use iocutil::prelude::*; let ch = ContentHash::of_file(r"./Cargo.toml").expect("failed to calc hash"); println!("{:?}", ch);
Trait Implementations
impl Into<ContentHash> for FileReport
[src]
fn into(self) -> ContentHash
[src]
impl IntoIterator for ContentHash
[src]
type Item = SampleHash
The type of the elements being iterated over.
type IntoIter = IntoIter<Self::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Example
use iocutil::prelude::*; let s = ContentHash::of_file("./Cargo.toml").unwrap(); let set: std::collections::HashSet<SampleHash> = s.into_iter().collect(); assert_eq!(set.len(), 3);
impl Clone for ContentHash
[src]
fn clone(&self) -> ContentHash
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for ContentHash
[src]
fn default() -> Self
[src]
return ContentHash of empty bytes as default
Example
use iocutil::prelude::*; let c = ContentHash::default(); assert_eq!(c.sha256.as_ref(), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); assert_eq!(c.sha1.as_ref(), "da39a3ee5e6b4b0d3255bfef95601890afd80709"); assert_eq!(c.md5.as_ref(), "d41d8cd98f00b204e9800998ecf8427e");
impl Eq for ContentHash
[src]
impl PartialEq<ContentHash> for ContentHash
[src]
fn eq(&self, other: &ContentHash) -> bool
[src]
fn ne(&self, other: &ContentHash) -> bool
[src]
impl Debug for ContentHash
[src]
impl Hash for ContentHash
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for ContentHash
[src]
impl StructuralEq for ContentHash
[src]
Auto Trait Implementations
impl Send for ContentHash
impl Sync for ContentHash
impl Unpin for ContentHash
impl UnwindSafe for ContentHash
impl RefUnwindSafe for ContentHash
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,