pub struct LocalMockTransport<'a> { /* private fields */ }Expand description
Ordered mock transport whose futures are intentionally local-only.
The Cell marker makes this type !Sync, so futures borrowing it cannot be
sent between threads. It exercises browser, embedded, and single-threaded
executor integrations without adding an allocator or runtime dependency.
ⓘ
use cloud_sdk_testkit::LocalMockTransport;
fn require_sync<T: Sync>() {}
require_sync::<LocalMockTransport<'static>>();Implementations§
Source§impl<'a> LocalMockTransport<'a>
impl<'a> LocalMockTransport<'a>
Sourcepub const fn new(exchanges: &'a [MockExchange<'a>]) -> Self
pub const fn new(exchanges: &'a [MockExchange<'a>]) -> Self
Creates a local-only mock over an ordered exchange slice.
Sourcepub const fn with_endpoint(self, endpoint: EndpointIdentity<'a>) -> Self
pub const fn with_endpoint(self, endpoint: EndpointIdentity<'a>) -> Self
Binds the mock permanently to one normalized endpoint identity.
Sourcepub const fn with_credential_binding(self, binding: CredentialBinding) -> Self
pub const fn with_credential_binding(self, binding: CredentialBinding) -> Self
Selects a deterministic credential lineage for association tests.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Reports whether every expected exchange was consumed.
Trait Implementations§
Source§impl BoundCredentialTransport for LocalMockTransport<'_>
impl BoundCredentialTransport for LocalMockTransport<'_>
Source§fn credential_binding(&self) -> CredentialBinding
fn credential_binding(&self) -> CredentialBinding
Returns the current transport credential lifecycle.
Source§impl BoundTransport for LocalMockTransport<'_>
impl BoundTransport for LocalMockTransport<'_>
Source§fn endpoint_identity(
&self,
) -> Result<EndpointIdentity<'_>, EndpointIdentityError>
fn endpoint_identity( &self, ) -> Result<EndpointIdentity<'_>, EndpointIdentityError>
Returns the immutable normalized endpoint identity.
Source§impl Debug for LocalMockTransport<'_>
impl Debug for LocalMockTransport<'_>
Source§impl LocalAsyncAuthenticatedTransport for LocalMockTransport<'_>
impl LocalAsyncAuthenticatedTransport for LocalMockTransport<'_>
Source§async fn send_authenticated_local<'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,
async fn send_authenticated_local<'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 sends one authenticated request locally.
Source§impl LocalAsyncTransport for LocalMockTransport<'_>
impl LocalAsyncTransport for LocalMockTransport<'_>
Source§async fn send_local<'transport, 'request, 'writer, 'buffer>(
&'transport self,
request: TransportRequest<'request>,
response: AsyncResponseStaging<'writer, 'buffer>,
) -> Result<ResponseCompletion, Self::Error>where
'transport: 'writer,
'request: 'writer,
'buffer: 'writer,
async fn send_local<'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 response without requiring the returned future to be
Send.Auto Trait Implementations§
impl<'a> !Freeze for LocalMockTransport<'a>
impl<'a> !RefUnwindSafe for LocalMockTransport<'a>
impl<'a> !Sync for LocalMockTransport<'a>
impl<'a> Send for LocalMockTransport<'a>
impl<'a> Unpin for LocalMockTransport<'a>
impl<'a> UnsafeUnpin for LocalMockTransport<'a>
impl<'a> UnwindSafe for LocalMockTransport<'a>
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