[−][src]Struct ipfs_unixfs::file::adder::FileAdder
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]
&mut self,
input: &[u8]
) -> (impl Iterator<Item = (Cid, Vec<u8>)>, usize)
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
Auto Trait Implementations
impl RefUnwindSafe for FileAdder
impl Send for FileAdder
impl Sync for FileAdder
impl Unpin for FileAdder
impl UnwindSafe for FileAdder
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>,