pub trait Server: Clone {
// Required methods
fn run_future<F, O>(&self, future: F) -> O
where F: Future<Output = O>;
fn request_expiry(&self) -> Sleep ⓘ;
// Provided method
fn run_request<F>(&self, f: F) -> Result<F::Ok>
where F: TryFuture + Unpin + Send + 'static,
F::Ok: Send,
F::Error: Into<Error> + Send { ... }
}
Expand description
An in memory server for testing purposes.
Required Methods§
sourcefn run_future<F, O>(&self, future: F) -> Owhere
F: Future<Output = O>,
fn run_future<F, O>(&self, future: F) -> Owhere
F: Future<Output = O>,
Runs a Future until it resolves.
sourcefn request_expiry(&self) -> Sleep ⓘ
fn request_expiry(&self) -> Sleep ⓘ
Returns a Delay that will expire when a request should.
Provided Methods§
sourcefn run_request<F>(&self, f: F) -> Result<F::Ok>
fn run_request<F>(&self, f: F) -> Result<F::Ok>
Runs the event loop until the response future is completed.
If the future came from a different instance of Server
, the event loop will run until
the timeout is triggered.
Object Safety§
This trait is not object safe.