pub trait AsyncFileReprwhere
Self: Sized,{
type Err: Error;
// Required methods
fn load<'async_trait>(
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait;
fn flush<'life0, 'async_trait>(
self: &'life0 Arc<Self>,
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'async_trait>(
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Expand description
A data structure with a file representation which can be loaded from and flushed to disk asynchronously.
Required Associated Types§
Required Methods§
Sourcefn load<'async_trait>(
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
fn load<'async_trait>(
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
Load the data structure from disk asynchronously.
If you wish to perform non-trivial deserialisation in this function, you should spawn a blocking task with your async runtime.
Sourcefn flush<'life0, 'async_trait>(
self: &'life0 Arc<Self>,
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
self: &'life0 Arc<Self>,
path: impl 'async_trait + AsRef<Path> + Send,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush the data structure to disk asynchronously.
If you wish to perform non-trivial serialisation in this function, you should spawn a blocking task with your async runtime.
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.