Skip to main content

AsyncFileStore

Trait AsyncFileStore 

Source
pub trait AsyncFileStore {
    type Error;
    type WriteHandle;

    // Required methods
    async fn begin_write(
        &mut self,
        transfer_id: u32,
        total_len: u32,
    ) -> Result<Self::WriteHandle, Self::Error>;
    async fn write_at(
        &mut self,
        handle: &mut Self::WriteHandle,
        offset: u32,
        bytes: &[u8],
    ) -> Result<(), Self::Error>;
    async fn commit(
        &mut self,
        handle: Self::WriteHandle,
    ) -> Result<(), Self::Error>;
    async fn abort(&mut self, handle: Self::WriteHandle);
}
Expand description

Async dependency required by the file-transfer bundle: a byte-addressable file store.

This is intended for async runtimes such as embassy, where storage I/O (flash, SD, etc.) should not block the entire executor.

Required Associated Types§

Required Methods§

Source

async fn begin_write( &mut self, transfer_id: u32, total_len: u32, ) -> Result<Self::WriteHandle, Self::Error>

Source

async fn write_at( &mut self, handle: &mut Self::WriteHandle, offset: u32, bytes: &[u8], ) -> Result<(), Self::Error>

Source

async fn commit(&mut self, handle: Self::WriteHandle) -> Result<(), Self::Error>

Source

async fn abort(&mut self, handle: Self::WriteHandle)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§