pub struct SessionCreateRequest { /* private fields */ }Expand description
Request type for SessionOperations::create.
Bundles the required session parameters (user ID, lifetime) with optional
context (IP address, user-agent) so callers never need to pass None
explicitly.
§Example
// Minimal — no optional fields:
let req = SessionCreateRequest::new("user-123", Duration::from_secs(3600));
// With optional context:
let req = SessionCreateRequest::new("user-123", Duration::from_secs(3600))
.ip_address("10.0.0.1")
.user_agent("Mozilla/5.0");Implementations§
Source§impl SessionCreateRequest
impl SessionCreateRequest
Sourcepub fn new(user_id: impl Into<String>, expires_in: Duration) -> Self
pub fn new(user_id: impl Into<String>, expires_in: Duration) -> Self
Create a request with the required fields.
Sourcepub fn ip_address(self, ip: impl Into<String>) -> Self
pub fn ip_address(self, ip: impl Into<String>) -> Self
Attach a client IP address for audit / geolocation.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Attach a User-Agent string for device tracking.
Sourcepub fn get_user_id(&self) -> &str
pub fn get_user_id(&self) -> &str
Returns the user ID this session is being created for.
Sourcepub fn get_expires_in(&self) -> Duration
pub fn get_expires_in(&self) -> Duration
Returns how long until the session expires.
Sourcepub fn get_ip_address(&self) -> Option<&str>
pub fn get_ip_address(&self) -> Option<&str>
Returns the client IP address, if attached.
Sourcepub fn get_user_agent(&self) -> Option<&str>
pub fn get_user_agent(&self) -> Option<&str>
Returns the User-Agent header value, if attached.
Trait Implementations§
Source§impl Clone for SessionCreateRequest
impl Clone for SessionCreateRequest
Source§fn clone(&self) -> SessionCreateRequest
fn clone(&self) -> SessionCreateRequest
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 moreAuto Trait Implementations§
impl Freeze for SessionCreateRequest
impl RefUnwindSafe for SessionCreateRequest
impl Send for SessionCreateRequest
impl Sync for SessionCreateRequest
impl Unpin for SessionCreateRequest
impl UnsafeUnpin for SessionCreateRequest
impl UnwindSafe for SessionCreateRequest
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