pub struct InstrumentedDriver { /* private fields */ }Expand description
Test-only driver wrapper that instruments an underlying driver: it records every operation for later assertion and can inject faults (connection loss, etc.) to exercise error-handling paths.
Implementations§
Source§impl InstrumentedDriver
impl InstrumentedDriver
pub fn new(driver: Box<dyn Driver>) -> Self
Sourcepub fn with_capability(self, capability: &'static Capability) -> Self
pub fn with_capability(self, capability: &'static Capability) -> Self
Report capability to the engine instead of the inner driver’s own,
so a test can watch how the engine plans for a backend it does not
have. The inner driver still executes whatever the engine asks of it.
Sourcepub fn handle(&self) -> InstrumentedHandle
pub fn handle(&self) -> InstrumentedHandle
Get the single control handle for this driver. The handle exposes both the operations log and the fault-injection queue.
Trait Implementations§
Source§impl Debug for InstrumentedDriver
impl Debug for InstrumentedDriver
Source§impl Driver for InstrumentedDriver
impl Driver for InstrumentedDriver
Source§fn capability(&self) -> &'static Capability
fn capability(&self) -> &'static Capability
Describes the driver’s capability, which informs the query planner.
Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 ConnectContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Connection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 ConnectContext,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Connection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new connection to the database. Read more
Source§fn generate_migration(&self, schema_diff: &Schema<'_>) -> Migration
fn generate_migration(&self, schema_diff: &Schema<'_>) -> Migration
Generates a migration from a
diff::Schema.Source§fn reset_db<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset_db<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Drops the entire database and recreates an empty one without applying migrations. Read more
Source§fn max_connections(&self) -> Option<usize>
fn max_connections(&self) -> Option<usize>
Returns the maximum number of simultaneous database connections supported. For example,
this is
Some(1) for the in-memory SQLite driver which cannot be pooled.Auto Trait Implementations§
impl !RefUnwindSafe for InstrumentedDriver
impl !UnwindSafe for InstrumentedDriver
impl Freeze for InstrumentedDriver
impl Send for InstrumentedDriver
impl Sync for InstrumentedDriver
impl Unpin for InstrumentedDriver
impl UnsafeUnpin for InstrumentedDriver
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