pub struct BlockMap {
pub files: Vec<BlockFile>,
pub total_blocks: u32,
pub slice_size: u64,
}Expand description
Maps between global slice indices and per-file slice positions.
Global indices run across the set’s files in the Main packet’s file order (falling back to File ID order if the Main packet listed none); this is the order the PAR2 input constants are assigned in.
Fields§
§files: Vec<BlockFile>Files in global order.
total_blocks: u32Total number of input slices across all files.
slice_size: u64Slice size in bytes.
Implementations§
Source§impl BlockMap
impl BlockMap
Sourcepub fn new(file_set: &Par2FileSet) -> Self
pub fn new(file_set: &Par2FileSet) -> Self
Build the global slice map for a file set. Same as build_block_map.
Sourcepub fn global_to_file(&self, global_idx: usize) -> Option<SliceLocation<'_>>
pub fn global_to_file(&self, global_idx: usize) -> Option<SliceLocation<'_>>
Locate a global slice index: its file, byte offset and real length.
None if the index is out of range.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockMap
impl RefUnwindSafe for BlockMap
impl Send for BlockMap
impl Sync for BlockMap
impl Unpin for BlockMap
impl UnsafeUnpin for BlockMap
impl UnwindSafe for BlockMap
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