pub struct SimStorageProvider { /* private fields */ }Expand description
Simulated storage provider for deterministic testing.
This provider wraps a WeakSimWorld and implements the StorageProvider
trait to enable deterministic storage simulation with fault injection.
§Example
ⓘ
let sim = SimWorld::new();
let provider = SimStorageProvider::new(sim.weak());
let file = provider.open("test.txt", OpenOptions::create_write()).await?;Implementations§
Source§impl SimStorageProvider
impl SimStorageProvider
Sourcepub fn new(sim: WeakSimWorld) -> Self
pub fn new(sim: WeakSimWorld) -> Self
Create a new simulated storage provider.
Trait Implementations§
Source§impl Clone for SimStorageProvider
impl Clone for SimStorageProvider
Source§fn clone(&self) -> SimStorageProvider
fn clone(&self) -> SimStorageProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimStorageProvider
impl Debug for SimStorageProvider
Source§impl StorageProvider for SimStorageProvider
impl StorageProvider for SimStorageProvider
Source§type File = SimStorageFile
type File = SimStorageFile
The file type for this provider.
Source§fn open<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: OpenOptions,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn open<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: OpenOptions,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open a file with the given options.
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a file exists at the given path.
Auto Trait Implementations§
impl Freeze for SimStorageProvider
impl !RefUnwindSafe for SimStorageProvider
impl !Send for SimStorageProvider
impl !Sync for SimStorageProvider
impl Unpin for SimStorageProvider
impl UnsafeUnpin for SimStorageProvider
impl !UnwindSafe for SimStorageProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more