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
fn take_from(_: &mut State) -> T
fn borrow_from(_: &State) -> &T
fn borrow_mut_from(_: &mut State) -> &mut T
Implementations on Foreign Types
impl FromState<Headers> for Headers
[src]
impl FromState<Uri> for Uri
[src]
impl FromState<HttpVersion> for HttpVersion
[src]
fn take_from(s: &mut State) -> Self
[src]
fn borrow_from(s: &State) -> &HttpVersion
[src]
fn borrow_mut_from(s: &mut State) -> &mut HttpVersion
[src]
impl FromState<Method> for Method
[src]
Implementors
impl<T> FromState<SessionData<T>> for SessionData<T> where
T: Default + Serialize + for<'de> Deserialize<'de> + Send + 'static,