Session

Struct Session 

Source
pub struct Session<S: RawSession> { /* private fields */ }
Expand description

An interface of session values.

Implementations§

Source§

impl<S> Session<S>
where S: RawSession,

Source

pub fn get<T>(&self, name: &str) -> Result<Option<T>>

Retrieves a field from this session and parses it into the specified type.

Source

pub fn contains(&self, name: &str) -> bool

Returns true if the field of specified name exists in this session.

Source

pub fn set<T>(&mut self, name: &str, value: T) -> Result<()>
where T: Serialize,

Sets a field to this session with serializing the specified value into a string.

Source

pub fn remove(&mut self, name: &str)

Removes a field from this session.

Source

pub fn clear(&mut self)

Marks this session cleared.

Source

pub fn finish<T>( self, output: T, ) -> impl Responder<Response = T::Response, Error = Error, Respond = SessionRespond<S::WriteSession, T::Respond>>
where T: Responder,

Finalize the current session with the specified output.

Trait Implementations§

Source§

impl<S: Debug + RawSession> Debug for Session<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Session<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Session<S>
where S: RefUnwindSafe,

§

impl<S> Send for Session<S>
where S: Send,

§

impl<S> Sync for Session<S>
where S: Sync,

§

impl<S> Unpin for Session<S>
where S: Unpin,

§

impl<S> UnwindSafe for Session<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ConfigExt for T

Source§

fn modify<M>(self, modifier: M) -> Modify<M, Self>

Creates a Config with the specified ModifyHandler
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

Source§

fn try_into(self) -> Result<U, <T as TryInto<U>>::Error>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V