Skip to main content

StorageFile

Trait StorageFile 

Source
pub trait StorageFile:
    AsyncRead
    + AsyncWrite
    + AsyncSeek
    + Unpin {
    // Required methods
    fn sync_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sync_data<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn size<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_len<'life0, 'async_trait>(
        &'life0 self,
        size: u64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for file handles that support async read/write/seek operations.

Required Methods§

Source

fn sync_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush all OS-internal metadata and data to disk.

Source

fn sync_data<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush all data to disk (metadata may not be synced).

Source

fn size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current size of the file in bytes.

Source

fn set_len<'life0, 'async_trait>( &'life0 self, size: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the length of the file.

Implementors§