Trait gotham::state::FromState [] [src]

pub trait FromState<T> {
    fn take_from(_: &mut State) -> T;
fn borrow_from(_: &State) -> &T;
fn borrow_mut_from(_: &mut State) -> &mut T; }

A trait for accessing data that is known to be stored in State.

This is especially applicable to data which was been extracted by the Router such as Request path and query strings.

Panics

All functions panic if the value is a None when retrieved from State.

Required Methods

Moves out of State and returns ownership

Panics

When Self was not stored in State

Borrows from State storage

Panics

When Self was not stored in State

Mutably borrows from State storage

Panics

When Self was not stored in State

Implementors