Struct restest::context::Context [−][src]
pub struct Context { /* fields omitted */ }
Expand description
A structure that holds information about the backend we’re about to query.
All its setters are const
, meaning it can be placed in a module, and
accessed from anywhere in the module.
Example
use restest::{Context, Request};
const CONTEXT: Context = Context::new()
.with_port(80)
.with_host("http://localhost");
#[tokio::test]
async fn first_test() {
// Use CONTEXT.run(...) to run a request.
}
#[tokio::test]
async fn second_test() {
// Use CONTEXT.run(...) to run another request.
}
Implementations
Creates a new context with default values.
The default host is localhost.
The default port is port 80
.
Sets a host value.
The previously-set host is discarded.
Sets a port value.
The previously-set port is discarded.
Runs a request.
This function performs I/O, therefore it is marked as async
.
Auto Trait Implementations
impl RefUnwindSafe for Context
impl UnwindSafe for Context
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more