pub struct MockTransport { /* private fields */ }Expand description
Mock transport for testing.
Implementations§
Source§impl MockTransport
impl MockTransport
Sourcepub fn with_config(config: MockConfig) -> Self
pub fn with_config(config: MockConfig) -> Self
Create a mock transport with custom config.
Sourcepub fn sent_events(&self) -> Vec<UdmEvent>
pub fn sent_events(&self) -> Vec<UdmEvent>
Get all sent events.
Sourcepub fn last_event(&self) -> Option<UdmEvent>
pub fn last_event(&self) -> Option<UdmEvent>
Get the last sent event.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Get count of sent events.
Sourcepub fn clear_events(&self)
pub fn clear_events(&self)
Clear sent events.
Sourcepub fn set_config(&self, config: MockConfig)
pub fn set_config(&self, config: MockConfig)
Update the mock configuration.
Sourcepub fn set_failure_rate(&self, rate: f64)
pub fn set_failure_rate(&self, rate: f64)
Set failure rate.
Sourcepub fn set_latency(&self, latency_ms: u64)
pub fn set_latency(&self, latency_ms: u64)
Set latency.
Trait Implementations§
Source§impl Debug for MockTransport
impl Debug for MockTransport
Source§impl Default for MockTransport
impl Default for MockTransport
Source§impl Transport for MockTransport
impl Transport for MockTransport
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 UdmEvent,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 UdmEvent,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a single event.
Source§fn send_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
events: &'life1 [UdmEvent],
) -> Pin<Box<dyn Future<Output = PhyTraceResult<BatchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
events: &'life1 [UdmEvent],
) -> Pin<Box<dyn Future<Output = PhyTraceResult<BatchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a batch of events.
Source§fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the transport is connected/ready.
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the remote endpoint.
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PhyTraceResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from the remote endpoint.
Source§fn stats(&self) -> TransportStats
fn stats(&self) -> TransportStats
Get transport statistics.
Auto Trait Implementations§
impl !Freeze for MockTransport
impl RefUnwindSafe for MockTransport
impl Send for MockTransport
impl Sync for MockTransport
impl Unpin for MockTransport
impl UnwindSafe for MockTransport
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