[][src]Struct httptest::ServerHandle

pub struct ServerHandle<'a> { /* fields omitted */ }

A handle to a server. Expectations are inserted when the handle is dropped.

Methods from Deref<Target = Server>

pub fn addr(&self) -> SocketAddr[src]

Get the address the server is listening on.

pub fn url(&self, path_and_query: &str) -> Uri[src]

Get a fully formed url to the servers address.

If the server is listening on port 1234.

server.url("/foo?q=1") == "http://localhost:1234/foo?q=1"

pub fn url_str(&self, path_and_query: &str) -> String[src]

Get a fully formed url to the servers address as a String.

server.url_str(foo) == server.url(foo).to_string()

pub fn expect(&self, expectation: Expectation)[src]

Add a new expectation to the server.

pub fn verify_and_clear(&mut self)[src]

Verify all registered expectations. Panic if any are not met, then clear all expectations leaving the server running in a clean state.

Trait Implementations

impl<'a> Debug for ServerHandle<'a>[src]

impl<'_> Deref for ServerHandle<'_>[src]

type Target = Server

The resulting type after dereferencing.

impl<'_> DerefMut for ServerHandle<'_>[src]

impl<'_> Drop for ServerHandle<'_>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ServerHandle<'a>

impl<'a> Send for ServerHandle<'a>

impl<'a> Sync for ServerHandle<'a>

impl<'a> Unpin for ServerHandle<'a>

impl<'a> !UnwindSafe for ServerHandle<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.