pub trait SyncClient {
type Error: Error + Send + Sync + 'static;
// Required method
fn send(&self, request: HttpRequest) -> Result<HttpResponse, Self::Error>;
}Expand description
Something that can send a request and wait for the answer.
Required Associated Types§
Required Methods§
fn send(&self, request: HttpRequest) -> Result<HttpResponse, Self::Error>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<C: SyncClient + ?Sized> SyncClient for &C
A reference to a client is a client, which is what the &self receiver on
SyncClient::send already promises.
impl<C: SyncClient + ?Sized> SyncClient for &C
A reference to a client is a client, which is what the &self receiver on
SyncClient::send already promises.
Without this, a caller holding &dyn SyncClient<Error = E> — the natural
way to hold one of two clients, a production one and a Recorder — cannot
hand it to anything in this crate, because every send here is generic over
C: SyncClient and the trait object is not one. The delegating newtype that
closes the gap carries no decision, so the crate closes it instead.
?Sized is the load-bearing half: bounded to C: Sized the impl covers
&ConcreteClient and still not &dyn SyncClient<Error = E>, which is the
case that wanted the newtype.
The cost, which is a decision rather than a side effect: &C is spoken for,
so a downstream crate cannot write impl SyncClient for &Theirs. It writes
the impl on Theirs and takes the reference from here.