pub struct OpenFile { /* private fields */ }Expand description
A file’s list with its tree kept, for showing many parts of it, and for finding the chunks that hold a stretch of bytes.
Implementations§
Source§impl OpenFile
impl OpenFile
pub fn new(list: FileList) -> Result<Self>
As OpenFile::new, for a list that others hold too.
Sourcepub fn decode(bytes: &[u8]) -> Result<Self>
pub fn decode(bytes: &[u8]) -> Result<Self>
Reads a whole list as FileList::decode does, and keeps its tree.
The list is hashed once for both.
pub fn list(&self) -> &FileList
The list, to hold beside this.
Sourcepub fn start_of(&self, index: u64) -> Option<u64>
pub fn start_of(&self, index: u64) -> Option<u64>
The byte at which chunk index starts. The count gives the size.
Sourcepub fn chunks_for(&self, offset: u64, length: u64) -> Result<(u64, u64)>
pub fn chunks_for(&self, offset: u64, length: u64) -> Result<(u64, u64)>
The chunks that hold the length bytes from offset: the first one’s
number, and the number after the last one. The stretch must lie
inside the file and hold at least one byte.
Sourcepub fn open(&self, start: u64, end: u64) -> Result<FileBranch>
pub fn open(&self, start: u64, end: u64) -> Result<FileBranch>
Shows chunks start up to, not including, end.
Sourcepub fn open_bytes(&self, offset: u64, length: u64) -> Result<FileBranch>
pub fn open_bytes(&self, offset: u64, length: u64) -> Result<FileBranch>
Shows the chunks that hold the length bytes from offset.
Trait Implementations§
Auto Trait Implementations§
impl Forget for OpenFile
impl Freeze for OpenFile
impl Move for OpenFile
impl RefUnwindSafe for OpenFile
impl Send for OpenFile
impl Sync for OpenFile
impl Unpin for OpenFile
impl UnsafeUnpin for OpenFile
impl UnwindSafe for OpenFile
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> 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