pub struct SimStorageProvider { /* private fields */ }Expand description
Simulated storage provider for deterministic testing.
Each provider is scoped to a specific process IP address. Files opened through this provider are tagged with the owner IP, enabling per-process fault injection and storage isolation.
§Example
ⓘ
let sim = SimWorld::new();
let ip: IpAddr = "10.0.1.1".parse().unwrap();
let provider = SimStorageProvider::new(sim.weak(), ip);
let file = provider.open("test.txt", OpenOptions::create_write()).await?;Implementations§
Source§impl SimStorageProvider
impl SimStorageProvider
Sourcepub fn new(sim: WeakSimWorld, owner_ip: IpAddr) -> Self
pub fn new(sim: WeakSimWorld, owner_ip: IpAddr) -> Self
Create a new simulated storage provider scoped to a process IP.
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