Enum wnfs_unixfs_file::unixfs::UnixFsFile
source · pub enum UnixFsFile {
Raw(Bytes),
Node(Node),
}
Variants§
Implementations§
source§impl UnixFsFile
impl UnixFsFile
pub fn empty() -> Self
pub async fn load(cid: &Cid, store: &impl BlockStore) -> Result<Self>
pub fn decode(cid: &Cid, buf: Bytes) -> Result<Self>
pub fn encode(&self) -> Result<Block>
pub const fn typ(&self) -> Option<DataType>
sourcepub fn size(&self) -> Option<usize>
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.
sourcepub fn filesize(&self) -> Option<u64>
pub fn filesize(&self) -> Option<u64>
Returns the filesize in bytes.
Should only be set for Raw
and File
.
sourcepub fn blocksizes(&self) -> &[u64]
pub fn blocksizes(&self) -> &[u64]
Returns the blocksizes of the links Should only be set for File
pub fn links(&self) -> Links<'_>
pub fn links_owned(&self) -> Result<VecDeque<Link>>
pub async fn get_link_by_name<S: AsRef<str>>( &self, link_name: S ) -> Result<Option<LinkRef<'_>>>
pub fn into_content_reader<B: BlockStore>( self, store: &B, pos_max: Option<usize> ) -> Result<UnixFsFileReader<'_, B>>
Trait Implementations§
source§impl Clone for UnixFsFile
impl Clone for UnixFsFile
source§fn clone(&self) -> UnixFsFile
fn clone(&self) -> UnixFsFile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnixFsFile
impl Debug for UnixFsFile
source§impl LoadIpld for UnixFsFile
impl LoadIpld for UnixFsFile
fn decode_ipld(cid: &Cid, bytes: Bytes) -> Result<Self>
source§impl PartialEq for UnixFsFile
impl PartialEq for UnixFsFile
source§fn eq(&self, other: &UnixFsFile) -> bool
fn eq(&self, other: &UnixFsFile) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Storable for UnixFsFile
impl Storable for UnixFsFile
§type Serializable = 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,
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,
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>>>
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,
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 moresource§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,
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
impl StoreIpld for UnixFsFile
impl StructuralPartialEq for UnixFsFile
Auto Trait Implementations§
impl RefUnwindSafe for UnixFsFile
impl Send for UnixFsFile
impl Sync for UnixFsFile
impl Unpin for UnixFsFile
impl UnwindSafe for UnixFsFile
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more