Skip to main content

SessionCookieGenerator

Trait SessionCookieGenerator 

Source
pub trait SessionCookieGenerator {
    const COOKIE_LENGTH: usize;

    // Required method
    fn generate_cookie(&self) -> String;
}
Expand description

A type with the ability to generate cookies. If the generator needs some mutable state, then it has to be behind a mutex or similar. This is to allow handling concurrent requests with a single session store instance.

(If you think it would be better to have a exclusive access to the session store for each request, please feel free to open an issue :) )

Required Associated Constants§

Source

const COOKIE_LENGTH: usize

The length of the session cookie, in characters. The default choice is 32, which is secure. It should be a multiple of 32, which is the block size of blake3.

Required Methods§

Generate a cookie, i.e. a string that is a valid HTTP cookie value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§