Skip to main content

StorageFile

Trait StorageFile 

Source
pub trait StorageFile:
    AsyncRead
    + AsyncWrite
    + AsyncSeek
    + Unpin
    + Send
    + Sync
    + 'static {
    // Required methods
    fn sync_all(&self) -> impl Future<Output = Result<()>> + Send;
    fn sync_data(&self) -> impl Future<Output = Result<()>> + Send;
    fn size(&self) -> impl Future<Output = Result<u64>> + Send;
    fn set_len(&self, size: u64) -> impl Future<Output = Result<()>> + Send;
}
Expand description

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

Required Methods§

Source

fn sync_all(&self) -> impl Future<Output = Result<()>> + Send

Flush all OS-internal metadata and data to disk.

Source

fn sync_data(&self) -> impl Future<Output = Result<()>> + Send

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

Source

fn size(&self) -> impl Future<Output = Result<u64>> + Send

Get the current size of the file in bytes.

Source

fn set_len(&self, size: u64) -> impl Future<Output = Result<()>> + Send

Set the length of the file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl StorageFile for TokioStorageFile

Available on crate feature tokio-providers only.