pub enum ExpectedHash {
Whole {
hash: Sha1Digest,
},
Blocks {
block_size: u64,
hashes: Vec<Sha1Digest>,
},
}Expand description
Expected hash spec for a single file.
Either a single whole-file digest, or a fixed-block-size digest per block.
Block-mode is what FFXIV patch lists actually carry for .dat files
(50 MiB blocks), because it pinpoints which block is bad. Whole-file
mode is the natural fit for small files (e.g. .index files), where a
single mismatched bit is best surfaced as a single failure.
Variants§
Whole
Whole-file mode: a single SHA-1 digest over the entire file.
Fields
§
hash: Sha1DigestExpected digest.
Blocks
Block-mode: file is split into block_size-byte chunks, each hashed
independently. The last block may be shorter than block_size.
Fields
§
hashes: Vec<Sha1Digest>One digest per block, in file order.
Implementations§
Source§impl ExpectedHash
impl ExpectedHash
Sourcepub fn whole(hash: Sha1Digest) -> Self
pub fn whole(hash: Sha1Digest) -> Self
Construct a whole-file SHA-1 spec.
Sourcepub fn blocks(block_size: u64, hashes: Vec<Sha1Digest>) -> Self
pub fn blocks(block_size: u64, hashes: Vec<Sha1Digest>) -> Self
Construct a block-mode SHA-1 spec.
Trait Implementations§
Source§impl Clone for ExpectedHash
impl Clone for ExpectedHash
Source§fn clone(&self) -> ExpectedHash
fn clone(&self) -> ExpectedHash
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ExpectedHash
impl Debug for ExpectedHash
Source§impl PartialEq for ExpectedHash
impl PartialEq for ExpectedHash
Source§fn eq(&self, other: &ExpectedHash) -> bool
fn eq(&self, other: &ExpectedHash) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ExpectedHash
impl StructuralPartialEq for ExpectedHash
Auto Trait Implementations§
impl Freeze for ExpectedHash
impl RefUnwindSafe for ExpectedHash
impl Send for ExpectedHash
impl Sync for ExpectedHash
impl Unpin for ExpectedHash
impl UnsafeUnpin for ExpectedHash
impl UnwindSafe for ExpectedHash
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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