pub struct BufferingTreeBuilder { /* private fields */ }
Expand description
UnixFs directory tree builder which buffers entries until build()
is called.
Implementations§
Source§impl BufferingTreeBuilder
impl BufferingTreeBuilder
Sourcepub fn new(opts: TreeOptions) -> Self
pub fn new(opts: TreeOptions) -> Self
Construct a new tree builder with the given configuration.
Sourcepub fn put_link(
&mut self,
full_path: &str,
target: Cid,
total_size: u64,
) -> Result<(), TreeBuildingFailed>
pub fn put_link( &mut self, full_path: &str, target: Cid, total_size: u64, ) -> Result<(), TreeBuildingFailed>
Registers the given path to be a link to the cid that follows. The target leaf should be either a file, directory or symlink but could of course be anything. It will be treated as an opaque link.
Sourcepub fn set_metadata(
&mut self,
full_path: &str,
metadata: Metadata,
) -> Result<(), TreeBuildingFailed>
pub fn set_metadata( &mut self, full_path: &str, metadata: Metadata, ) -> Result<(), TreeBuildingFailed>
Directories get “put” implicitly through the put files, and directories need to be adjusted only when wanting them to have metadata.
Sourcepub fn build(self) -> PostOrderIterator ⓘ
pub fn build(self) -> PostOrderIterator ⓘ
Called to build the tree. The built tree will have the added files and their implied
directory structure, along with the directory entries which were created using
set_metadata
. To build the whole hierarchy, one must iterate the returned iterator to
completion while storing the created blocks.
Returned PostOrderIterator
will use the given full_path
and block_buffer
to store
its data during the walk. PostOrderIterator
implements Iterator
while also allowing
borrowed access via next_borrowed
.
Trait Implementations§
Source§impl Debug for BufferingTreeBuilder
impl Debug for BufferingTreeBuilder
Auto Trait Implementations§
impl Freeze for BufferingTreeBuilder
impl RefUnwindSafe for BufferingTreeBuilder
impl Send for BufferingTreeBuilder
impl Sync for BufferingTreeBuilder
impl Unpin for BufferingTreeBuilder
impl UnwindSafe for BufferingTreeBuilder
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
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>
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>
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