pub struct Session { /* private fields */ }Expand description
M2M protocol session
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(capabilities: Capabilities) -> Self
pub fn new(capabilities: Capabilities) -> Self
Create new session with capabilities
Sourcepub fn with_id(id: &str, capabilities: Capabilities) -> Self
pub fn with_id(id: &str, capabilities: Capabilities) -> Self
Create session with existing ID (for server-side)
Sourcepub fn state(&self) -> SessionState
pub fn state(&self) -> SessionState
Get current state
Sourcepub fn is_established(&self) -> bool
pub fn is_established(&self) -> bool
Check if session is established
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if session is expired
Sourcepub fn encoding(&self) -> Option<Encoding>
pub fn encoding(&self) -> Option<Encoding>
Get negotiated encoding (for TokenNative compression)
Sourcepub fn create_hello(&mut self) -> Message
pub fn create_hello(&mut self) -> Message
Create HELLO message to initiate handshake
Sourcepub fn process_hello(&mut self, hello: &Message) -> Result<Message>
pub fn process_hello(&mut self, hello: &Message) -> Result<Message>
Process incoming HELLO and create ACCEPT/REJECT response
Sourcepub fn process_accept(&mut self, accept: &Message) -> Result<()>
pub fn process_accept(&mut self, accept: &Message) -> Result<()>
Process incoming ACCEPT message
Sourcepub fn process_reject(&mut self, reject: &Message) -> Result<()>
pub fn process_reject(&mut self, reject: &Message) -> Result<()>
Process incoming REJECT message
Sourcepub fn decompress(&mut self, message: &Message) -> Result<String>
pub fn decompress(&mut self, message: &Message) -> Result<String>
Decompress DATA message content
Sourcepub fn process_message(&mut self, message: &Message) -> Result<Option<Message>>
pub fn process_message(&mut self, message: &Message) -> Result<Option<Message>>
Process any incoming message
Sourcepub fn stats(&self) -> SessionStats
pub fn stats(&self) -> SessionStats
Get session statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
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
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