[−][src]Struct ipfs_unixfs::file::reader::FileReader
Navigates the UnixFs files, which are either:
- single block files which have everything needed to all of the contents
- multi block files which have trees of trees until Raw leaf blocks
The trees can have different shapes but it doesn't really matter for our depth-first approach. For seeking, the each sub-tree linking node will have blocksizes for the trees representing which the original file offsets covered by the tree.
A file doesn't know it's name. It only has a name when part of a directory, and then the name is on a PbLink::Name. With UnixFs the names are always UTF-8. The root CID is not interesting either: we just need the root block.
Implementations
impl<'a> FileReader<'a>
[src]
pub fn from_block(data: &'a [u8]) -> Result<Self, FileReadFailed>
[src]
Method for starting the file traversal. data
is the raw data from unixfs block.
pub fn content(
self
) -> (FileContent<'a, impl Iterator<Item = (PBLink<'a>, Range<u64>)>>, Traversal)
[src]
self
) -> (FileContent<'a, impl Iterator<Item = (PBLink<'a>, Range<u64>)>>, Traversal)
Returns a moved tuple of the content (bytes or links) and a traversal, which can be used to continue the traversal from the next block.
pub fn file_size(&self) -> u64
[src]
Returns the total size of the file.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for FileReader<'a>
impl<'a> Send for FileReader<'a>
impl<'a> Sync for FileReader<'a>
impl<'a> Unpin for FileReader<'a>
impl<'a> UnwindSafe for FileReader<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
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>,