pub enum StringSession {
V1(FullSession),
V2(Session),
}Variants§
V1(FullSession)
V2(Session)
Implementations§
Source§impl StringSession
impl StringSession
Sourcepub fn decode(s: &str) -> Result<Self, StringSessionError>
pub fn decode(s: &str) -> Result<Self, StringSessionError>
Decode a string session. Auto-detects V1 or V2 from the version byte.
Sourcepub fn encode_v1(&self) -> String
pub fn encode_v1(&self) -> String
Encode as V1 (full session with salt, seq_no, layer). Use this for manual transfer or when full state is needed.
Sourcepub fn session(&self) -> Session
pub fn session(&self) -> Session
The minimal V2 fields, regardless of which version was decoded. For a
V1 session this drops server_salt/seq_no/layer; use
Self::full_session if you need those.
Sourcepub fn full_session(&self) -> Option<&FullSession>
pub fn full_session(&self) -> Option<&FullSession>
The full V1 fields, or None if this is a V2 session (V2 never
carried server_salt/seq_no/layer to begin with).
Sourcepub fn version(&self) -> u8
pub fn version(&self) -> u8
Which version this session was decoded as (1 or 2), independent of
which version Self::encode would produce.
Trait Implementations§
Source§impl Clone for StringSession
impl Clone for StringSession
Source§fn clone(&self) -> StringSession
fn clone(&self) -> StringSession
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 StringSession
impl Debug for StringSession
Source§impl From<FullSession> for StringSession
impl From<FullSession> for StringSession
Source§fn from(s: FullSession) -> Self
fn from(s: FullSession) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StringSession
impl RefUnwindSafe for StringSession
impl Send for StringSession
impl Sync for StringSession
impl Unpin for StringSession
impl UnsafeUnpin for StringSession
impl UnwindSafe for StringSession
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