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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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