pub struct SessionId(/* private fields */);Expand description
A typed wrapper around a logical session identifier.
§Examples
use adk_core::identity::SessionId;
// Parse from a known value
let sid = SessionId::try_from("session-abc-123").unwrap();
assert_eq!(sid.as_ref(), "session-abc-123");
// Or generate a new UUID-based session ID
let generated = SessionId::generate();
assert!(!generated.as_ref().is_empty());Implementations§
Source§impl SessionId
impl SessionId
Sourcepub fn new(value: impl Into<String>) -> Result<Self, IdentityError>
pub fn new(value: impl Into<String>) -> Result<Self, IdentityError>
Creates a typed identifier with validation.
Prefer this constructor at trust boundaries where the input may come from users, HTTP payloads, or external systems.
Sourcepub fn new_unchecked(value: impl Into<String>) -> Self
pub fn new_unchecked(value: impl Into<String>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SessionId
impl<'de> Deserialize<'de> for SessionId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for SessionId
impl Ord for SessionId
Source§impl PartialOrd for SessionId
impl PartialOrd for SessionId
impl Eq for SessionId
impl StructuralPartialEq for SessionId
Auto Trait Implementations§
impl Freeze for SessionId
impl RefUnwindSafe for SessionId
impl Send for SessionId
impl Sync for SessionId
impl Unpin for SessionId
impl UnsafeUnpin for SessionId
impl UnwindSafe for SessionId
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