pub trait Transport: Send + Sync {
// Required methods
fn send(
&self,
request: &Request,
) -> impl Future<Output = Result<RawResponse, TransportError>> + Send;
fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + Send;
}Available on crate feature
rest only.Expand description
The Adapter-provided way to send one HTTP request and to sleep; the REST client’s only contact
with the platform (worker::Fetch on Cloudflare, reqwest natively).
Implementations send exactly the given request: no retries, no redirects to follow for Discord,
no status handling. Non-2xx statuses are a normal RawResponse, only failures to get any
response at all are a TransportError.
Futures are Send so REST calls can run on any thread (ADR 0012); single-threaded platforms
wrap theirs (worker::send::SendFuture on Cloudflare).
Required Methods§
Sourcefn send(
&self,
request: &Request,
) -> impl Future<Output = Result<RawResponse, TransportError>> + Send
fn send( &self, request: &Request, ) -> impl Future<Output = Result<RawResponse, TransportError>> + Send
Sends request and returns Discord’s response, whatever its status
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Implementors§
impl Transport for ReqwestTransport
Available on crate feature
reqwest only.