pub struct Par2File {
pub file_id: Id16,
pub hash: Md5Hash,
pub hash_16k: Md5Hash,
pub size: u64,
pub filename: String,
pub slices: Vec<SliceChecksum>,
}Expand description
Metadata for a single file in the PAR2 set.
Fields§
§file_id: Id16File ID (MD5 of hash16k + hash + file_id internal data).
hash: Md5HashFull file MD5 hash.
hash_16k: Md5HashMD5 hash of the first 16 KiB of the file.
size: u64File size in bytes.
filename: StringFilename (from the PAR2 packet, UTF-8 or best-effort decoded).
slices: Vec<SliceChecksum>Per-slice checksums (MD5 + CRC32), in order. From IFSC packets.
Implementations§
Source§impl Par2File
impl Par2File
Sourcepub fn slice_matches(
&self,
local_index: usize,
data: &[u8],
slice_size: u64,
) -> bool
pub fn slice_matches( &self, local_index: usize, data: &[u8], slice_size: u64, ) -> bool
Whether data matches the IFSC checksum of this file’s slice
local_index (0-based within the file).
data is the slice as it appears in the file: slice_size bytes, or
fewer for the file’s last slice. Returns false if the index is out of
range or the length is wrong for that slice.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Par2File
impl RefUnwindSafe for Par2File
impl Send for Par2File
impl Sync for Par2File
impl Unpin for Par2File
impl UnsafeUnpin for Par2File
impl UnwindSafe for Par2File
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