pub struct FileAdder { /* private fields */ }
Expand description

File tree builder. Implements core::default::Default which tracks the recent defaults.

Custom file tree builder can be created with FileAdder::builder() and configuring the chunker and collector.

Current implementation maintains an internal buffer for the block creation and uses a non-customizable hash function to produce Cid version 0 links. Currently does not support inline links.

Implementations§

Returns a FileAdderBuilder for creating a non-default FileAdder.

Returns the likely amount of buffering the file adding will work with best.

When using the size based chunker and input larger than or equal to the hint is push()’ed to the chunker, the internal buffer will not be used.

Called to push new file bytes into the tree builder.

Returns the newly created blocks (at most 2) and their respective Cids, and the amount of input consumed.

Called after the last FileAdder::push to finish the tree construction.

Returns a list of Cids and their respective blocks.

Note: the API will hopefully evolve in a direction which will not allocate a new Vec for every block in the near-ish future.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Scrape the references from an impl Read. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.