[][src]Struct ipfs_unixfs::file::adder::FileAdder

pub struct FileAdder { /* fields omitted */ }

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

impl FileAdder[src]

pub fn builder() -> FileAdderBuilder[src]

Returns a FileAdderBuilder for creating a non-default FileAdder.

pub fn size_hint(&self) -> usize[src]

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.

pub fn push(
    &mut self,
    input: &[u8]
) -> (impl Iterator<Item = (Cid, Vec<u8>)>, usize)
[src]

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.

pub fn finish(self) -> impl Iterator<Item = (Cid, Vec<u8>)>[src]

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

impl Debug for FileAdder[src]

impl Default for FileAdder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.