pub enum UnixFsFile {
    Raw(Bytes),
    Node(Node),
}

Variants§

§

Raw(Bytes)

§

Node(Node)

Implementations§

source§

impl UnixFsFile

source

pub fn empty() -> Self

source

pub async fn load(cid: &Cid, store: &impl BlockStore) -> Result<Self>

source

pub fn decode(cid: &Cid, buf: Bytes) -> Result<Self>

source

pub fn encode(&self) -> Result<Block>

source

pub const fn typ(&self) -> Option<DataType>

source

pub fn size(&self) -> Option<usize>

Returns the size in bytes of the underlying data. Available only for Raw and File which are a single block with no links.

source

pub fn filesize(&self) -> Option<u64>

Returns the filesize in bytes. Should only be set for Raw and File.

source

pub fn blocksizes(&self) -> &[u64]

Returns the blocksizes of the links Should only be set for File

source

pub fn into_content_reader<B: BlockStore>( self, store: &B, pos_max: Option<usize> ) -> Result<UnixFsFileReader<'_, B>>

Trait Implementations§

source§

impl Clone for UnixFsFile

source§

fn clone(&self) -> UnixFsFile

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UnixFsFile

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl LoadIpld for UnixFsFile

source§

fn decode_ipld(cid: &Cid, bytes: Bytes) -> Result<Self>

source§

impl PartialEq for UnixFsFile

source§

fn eq(&self, other: &UnixFsFile) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Storable for UnixFsFile

§

type Serializable = UnixFsFile

The at-rest representation of this storable type.
source§

fn to_serializable<'life0, 'life1, 'async_trait>( &'life0 self, _store: &'life1 (impl 'async_trait + BlockStore) ) -> Pin<Box<dyn Future<Output = Result<Self::Serializable>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Turn the current type into the at-rest representation of this type.
source§

fn from_serializable<'life0, 'async_trait>( _cid: Option<&'life0 Cid>, serializable: Self::Serializable ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Take an at-rest representation of this type and turn it into the in-memory representation. You can use the cid parameter to populate a cache.
source§

fn persisted_as(&self) -> Option<&OnceCell<Cid<64>>>

Return a serialization cache, if it exists. By default, this always returns None.
source§

fn store<'life0, 'life1, 'async_trait>( &'life0 self, store: &'life1 (impl BlockStore + 'async_trait) ) -> Pin<Box<dyn Future<Output = Result<Cid<64>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Store this data type in a given BlockStore. Read more
source§

fn load<'life0, 'life1, 'async_trait>( cid: &'life0 Cid<64>, store: &'life1 (impl BlockStore + 'async_trait) ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

Try to load a value of this type from a CID. Read more
source§

impl StoreIpld for UnixFsFile

source§

impl StructuralPartialEq for UnixFsFile

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>
where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<S> CondSend for S
where S: Send,

source§

impl<S> CondSync for S
where S: Send + Sync,