Enum UnixFsFile

Source
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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Storable for UnixFsFile

Source§

type Serializable = UnixFsFile

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

async fn to_serializable( &self, _store: &impl BlockStore, ) -> Result<Self::Serializable>

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

async fn from_serializable( _cid: Option<&Cid>, serializable: Self::Serializable, ) -> Result<Self>

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( &self, store: &impl BlockStore, ) -> impl Future<Output = Result<Cid<64>, Error>> + CondSend
where Self: CondSync,

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

fn load( cid: &Cid<64>, store: &impl BlockStore, ) -> impl Future<Output = Result<Self, Error>> + CondSend

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> References<RawCodec> for T

Source§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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,