pub struct Walker { /* private fields */ }
Expand description
Walker
helps with walking a UnixFS tree, including all of the content and files. It is
created with Walker::new
and walked over each block with Walker::continue_block
. Use
Walker::pending_links
to obtain the next Cid
to be loaded and the prefetchable links.
Implementations§
Source§impl Walker
impl Walker
Sourcepub fn new(cid: Cid, root_name: String) -> Walker
pub fn new(cid: Cid, root_name: String) -> Walker
Returns a new instance of a walker, ready to start from the given Cid
.
Sourcepub fn pending_links(&self) -> (&Cid, impl Iterator<Item = &Cid> + '_)
pub fn pending_links(&self) -> (&Cid, impl Iterator<Item = &Cid> + '_)
Sourcepub fn next<'a: 'c, 'b: 'c, 'c>(
&'a mut self,
bytes: &'b [u8],
cache: &mut Option<Cache>,
) -> Result<ContinuedWalk<'c>, Error>
pub fn next<'a: 'c, 'b: 'c, 'c>( &'a mut self, bytes: &'b [u8], cache: &mut Option<Cache>, ) -> Result<ContinuedWalk<'c>, Error>
Continues the walk.
Returns a descriptor for the next element found as ContinuedWalk
which includes the means
to further continue the walk. bytes
is the raw data of the next block, cache
is an
optional cache for data structures which can always be substituted with &mut None
.
Sourcepub fn should_continue(&self) -> bool
pub fn should_continue(&self) -> bool
Returns true
if there are more links to walk over.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Walker
impl RefUnwindSafe for Walker
impl Send for Walker
impl Sync for Walker
impl Unpin for Walker
impl UnwindSafe for Walker
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> 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