Skip to main content

DynamicMockTransport

Struct DynamicMockTransport 

Source
pub struct DynamicMockTransport<'fixture, 'records, B> { /* private fields */ }
Expand description

Bounded allocation-free dynamic mock transport.

Implementations§

Source§

impl<'fixture, 'records, B> DynamicMockTransport<'fixture, 'records, B>

Source

pub fn new( builder: B, records: &'records [RequestRecordSlot], ) -> Result<Self, DynamicMockConfigError>

Creates a dynamic mock over clean caller-owned record slots.

Source

pub const fn with_endpoint(self, endpoint: EndpointIdentity<'fixture>) -> Self

Binds the mock permanently to one normalized endpoint identity.

Source

pub fn recorded(&self) -> usize

Returns the number of committed successful requests.

Source

pub const fn capacity(&self) -> usize

Returns the fixed caller-owned recording capacity.

Source

pub fn record(&self, index: usize) -> Option<RecordedRequest>

Returns one committed payload-free observation.

Trait Implementations§

Source§

impl<'fixture, B> AsyncAuthenticatedTransport for DynamicMockTransport<'fixture, '_, B>
where B: ProviderFixtureBuilder<'fixture> + Sync,

Source§

type Error = DynamicMockError<<B as ProviderFixtureBuilder<'fixture>>::Error>

Transport-specific failure.
Source§

async fn send_authenticated<'transport, 'request, 'policy, 'writer, 'buffer>( &'transport self, request: AuthenticatedRequest<'request, 'policy>, response: AsyncResponseStaging<'writer, 'buffer>, ) -> Result<ResponseCompletion, Self::Error>
where 'transport: 'writer, 'request: 'writer, 'policy: 'writer, 'buffer: 'writer,

Validates scope and stages one authenticated response.
Source§

impl<'fixture, B> AsyncTransport for DynamicMockTransport<'fixture, '_, B>
where B: ProviderFixtureBuilder<'fixture> + Sync,

Source§

type Error = DynamicMockError<<B as ProviderFixtureBuilder<'fixture>>::Error>

Transport-specific failure.
Source§

async fn send<'transport, 'request, 'writer, 'buffer>( &'transport self, request: TransportRequest<'request>, response: AsyncResponseStaging<'writer, 'buffer>, ) -> Result<ResponseCompletion, Self::Error>
where 'transport: 'writer, 'request: 'writer, 'buffer: 'writer,

Stages one complete response without committing it.
Source§

impl<'fixture, B> BlockingAuthenticatedTransport for DynamicMockTransport<'fixture, '_, B>
where B: ProviderFixtureBuilder<'fixture>,

Source§

type Error = DynamicMockError<<B as ProviderFixtureBuilder<'fixture>>::Error>

Transport-specific failure.
Source§

fn send_authenticated( &self, request: AuthenticatedRequest<'_, '_>, response: &mut ResponseWriter<'_>, ) -> Result<(), Self::Error>

Validates scope and sends one authenticated request.
Source§

impl<'fixture, B> BlockingTransport for DynamicMockTransport<'fixture, '_, B>
where B: ProviderFixtureBuilder<'fixture>,

Source§

type Error = DynamicMockError<<B as ProviderFixtureBuilder<'fixture>>::Error>

Transport-specific failure.
Source§

fn send( &self, request: TransportRequest<'_>, response: &mut ResponseWriter<'_>, ) -> Result<(), Self::Error>

Sends one request and writes the response body into the caller buffer. Read more
Source§

impl<B> BoundTransport for DynamicMockTransport<'_, '_, B>

Source§

fn endpoint_identity( &self, ) -> Result<EndpointIdentity<'_>, EndpointIdentityError>

Returns the immutable normalized endpoint identity.
Source§

impl<B> Debug for DynamicMockTransport<'_, '_, B>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'fixture, 'records, B> !Freeze for DynamicMockTransport<'fixture, 'records, B>

§

impl<'fixture, 'records, B> RefUnwindSafe for DynamicMockTransport<'fixture, 'records, B>
where B: RefUnwindSafe,

§

impl<'fixture, 'records, B> Send for DynamicMockTransport<'fixture, 'records, B>
where B: Send,

§

impl<'fixture, 'records, B> Sync for DynamicMockTransport<'fixture, 'records, B>
where B: Sync,

§

impl<'fixture, 'records, B> Unpin for DynamicMockTransport<'fixture, 'records, B>
where B: Unpin,

§

impl<'fixture, 'records, B> UnsafeUnpin for DynamicMockTransport<'fixture, 'records, B>
where B: UnsafeUnpin,

§

impl<'fixture, 'records, B> UnwindSafe for DynamicMockTransport<'fixture, 'records, B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LocalAsyncAuthenticatedTransport for T

Source§

type Error = <T as AsyncAuthenticatedTransport>::Error

Transport-specific failure.
Source§

async fn send_authenticated_local<'transport, 'request, 'policy, 'writer, 'buffer>( &'transport self, request: AuthenticatedRequest<'request, 'policy>, response: AsyncResponseStaging<'writer, 'buffer>, ) -> Result<ResponseCompletion, <T as LocalAsyncAuthenticatedTransport>::Error>
where 'transport: 'writer, 'request: 'writer, 'policy: 'writer, 'buffer: 'writer,

Validates scope and sends one authenticated request locally.
Source§

impl<T> LocalAsyncTransport for T
where T: AsyncTransport + ?Sized,

Source§

type Error = <T as AsyncTransport>::Error

Transport-specific failure.
Source§

async fn send_local<'transport, 'request, 'writer, 'buffer>( &'transport self, request: TransportRequest<'request>, response: AsyncResponseStaging<'writer, 'buffer>, ) -> Result<ResponseCompletion, <T as LocalAsyncTransport>::Error>
where 'transport: 'writer, 'request: 'writer, 'buffer: 'writer,

Stages one response without requiring the returned future to be Send.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.