pub struct SessionCookie(/* private fields */);Expand description
Type-safe wrapper for session cookies.
This provides compile-time safety to prevent mixing up session cookies with other string types. Session cookies are HTTP cookie values used for user session identification and must be properly validated to prevent session hijacking and other security issues.
Implementations§
Source§impl SessionCookie
impl SessionCookie
Sourcepub fn new(cookie: String) -> Result<Self, SessionError>
pub fn new(cookie: String) -> Result<Self, SessionError>
Creates a new SessionCookie from a string with validation.
This constructor validates the session cookie format to ensure it meets security requirements for session identification.
§Arguments
cookie- The session cookie string
§Returns
Ok(SessionCookie)- If the cookie is validErr(SessionError)- If the cookie is invalid
§Validation Rules
- Must not be empty
- Must contain only valid characters (alphanumeric + basic symbols)
- Must be reasonable length (not too short or too long)
Trait Implementations§
Source§impl Clone for SessionCookie
impl Clone for SessionCookie
Source§fn clone(&self) -> SessionCookie
fn clone(&self) -> SessionCookie
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionCookie
impl Debug for SessionCookie
Source§impl PartialEq for SessionCookie
impl PartialEq for SessionCookie
impl StructuralPartialEq for SessionCookie
Auto Trait Implementations§
impl Freeze for SessionCookie
impl RefUnwindSafe for SessionCookie
impl Send for SessionCookie
impl Sync for SessionCookie
impl Unpin for SessionCookie
impl UnwindSafe for SessionCookie
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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