pub struct SessionClientContext {
pub user_agent: Option<String>,
pub ip_address: Option<String>,
pub device_id: Option<String>,
}Expand description
Client-origin metadata captured at a trust boundary.
Fields are optional because not every adapter or runtime can provide every value safely or reliably.
§Examples
use webgates_sessions::context::SessionClientContext;
let client = SessionClientContext::new()
.with_ip_address("203.0.113.5")
.with_user_agent("MyApp/2.0")
.with_device_id("device-abc");
assert!(!client.is_empty());
assert_eq!(client.ip_address.as_deref(), Some("203.0.113.5"));Fields§
§user_agent: Option<String>User agent or equivalent client identifier.
ip_address: Option<String>Source IP address recorded as text to avoid transport-specific types.
device_id: Option<String>Stable device identifier when the outer system provides one.
Implementations§
Source§impl SessionClientContext
impl SessionClientContext
Sourcepub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
pub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
Sets the user agent value.
Sourcepub fn with_ip_address(self, ip_address: impl Into<String>) -> Self
pub fn with_ip_address(self, ip_address: impl Into<String>) -> Self
Sets the source IP address.
Sourcepub fn with_device_id(self, device_id: impl Into<String>) -> Self
pub fn with_device_id(self, device_id: impl Into<String>) -> Self
Sets the stable device identifier.
Trait Implementations§
Source§impl Clone for SessionClientContext
impl Clone for SessionClientContext
Source§fn clone(&self) -> SessionClientContext
fn clone(&self) -> SessionClientContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SessionClientContext
impl Debug for SessionClientContext
Source§impl Default for SessionClientContext
impl Default for SessionClientContext
Source§fn default() -> SessionClientContext
fn default() -> SessionClientContext
Returns the “default value” for a type. Read more
Source§impl PartialEq for SessionClientContext
impl PartialEq for SessionClientContext
Source§fn eq(&self, other: &SessionClientContext) -> bool
fn eq(&self, other: &SessionClientContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for SessionClientContext
impl StructuralPartialEq for SessionClientContext
Auto Trait Implementations§
impl Freeze for SessionClientContext
impl RefUnwindSafe for SessionClientContext
impl Send for SessionClientContext
impl Sync for SessionClientContext
impl Unpin for SessionClientContext
impl UnsafeUnpin for SessionClientContext
impl UnwindSafe for SessionClientContext
Blanket Implementations§
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