Skip to main content

PgNtexSession

Struct PgNtexSession 

Source
pub struct PgNtexSession<SE: StateEncryption + Clone>(/* private fields */);

Implementations§

Source§

impl<SE: StateEncryption + Clone> PgNtexSession<SE>

Source

pub fn new( key: impl AsRef<[u8]>, encryption_engine: Option<SE>, pooled_connection: Arc<Pool<ConnectionManager<PgConnection>>>, ) -> Self

Construct new signed PgNtexSession instance.

You can use UUID v4 as encryption key. Panics if key length is less than 32 bytes. pooled_connection is a Pool of Postgres Connection Manager. Check r2d2 Pool sample and ConnectionManager sample

Source

pub fn path<S: Into<String>>(self, value: S) -> Self

Sets the path field in the session cookie being built.

Source

pub fn name<S: Into<String>>(self, value: S) -> Self

Sets the name field in the session cookie being built.

Source

pub fn domain<S: Into<String>>(self, value: S) -> Self

Sets the domain field in the session cookie being built.

Source

pub fn secure(self, value: bool) -> Self

Sets the secure field in the session cookie being built.

If the secure field is set, a cookie will only be transmitted when the connection is secure - i.e. https

Source

pub fn http_only(self, value: bool) -> Self

Sets the http_only field in the session cookie being built.

Source

pub fn same_site(self, value: SameSite) -> Self

Sets the same_site field in the session cookie being built.

Source

pub fn max_age(self, seconds: u64) -> Self

Sets the max-age field in the session cookie being built.

Source

pub fn max_age_time(self, value: Duration) -> Self

Sets the max-age field in the session cookie being built.

Source

pub fn expires_in(self, seconds: u64) -> Self

Sets the expires field in the session cookie being built.

Source

pub fn expires_in_time(self, value: Duration) -> Self

Sets the expires field in the session cookie being built.

Trait Implementations§

Source§

impl<S, SE: StateEncryption + Clone> Middleware<S> for PgNtexSession<SE>

Source§

type Service = PgNtexSessionMiddleware<S, SE>

The middleware Service value created by this factory
Source§

fn create(&self, service: S) -> Self::Service

Creates and returns a new middleware Service

Auto Trait Implementations§

§

impl<SE> !Send for PgNtexSession<SE>

§

impl<SE> !Sync for PgNtexSession<SE>

§

impl<SE> Freeze for PgNtexSession<SE>

§

impl<SE> RefUnwindSafe for PgNtexSession<SE>
where SE: RefUnwindSafe,

§

impl<SE> Unpin for PgNtexSession<SE>

§

impl<SE> UnsafeUnpin for PgNtexSession<SE>

§

impl<SE> UnwindSafe for PgNtexSession<SE>
where SE: RefUnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more