AsyncArchiveReader

Trait AsyncArchiveReader 

Source
pub trait AsyncArchiveReader: Send + Sync {
    // Required methods
    fn read_entry<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn entry_exists<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_entries<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for reading entries from an archive asynchronously.

This trait provides async methods for reading archive contents without blocking the executor. It is analogous to lib3mf_core::archive::ArchiveReader but with async/await semantics.

§Trait Bounds

Implementors must be Send + Sync to allow the archive reader to be used across async task boundaries. This is required because async functions may be sent between threads in the tokio runtime.

§Implementors

Required Methods§

Source

fn read_entry<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads the content of an archive entry by name.

§Arguments
  • name - The entry path within the archive (e.g., “_rels/.rels”, “3D/3dmodel.model”)
§Returns

The full content of the entry as a Vec<u8>.

§Errors

Returns Lib3mfError::ResourceNotFound if the entry does not exist.

Returns Lib3mfError::Io if reading fails.

Source

fn entry_exists<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if an archive entry exists.

§Arguments
  • name - The entry path within the archive
§Returns

true if the entry exists, false otherwise.

Source

fn list_entries<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all entry names in the archive.

§Returns

A vector of all entry path names in the archive.

§Errors

Returns Lib3mfError::Io if the archive cannot be read.

Implementors§

Source§

impl<R: AsyncRead + AsyncSeek + Unpin + Send + Sync> AsyncArchiveReader for AsyncZipArchive<R>