[][src]Struct sage_broker::Session

pub struct Session { /* fields omitted */ }

Represents a client and holds all of its data, may it be active or not. If the client is connected, peer is used to retrieve its information and send him packets.

Implementations

impl Session[src]

pub fn new(client_id: &str, peer: &Arc<RwLock<Peer>>) -> Self[src]

Creates a new session, giving a peer and an id

pub fn id(&self) -> &str[src]

A unique ID that cannot be changed neither can collide with other instances of Session

pub fn client_id(&self) -> &str[src]

Returns the client_id of the session

pub fn peer(&self) -> Option<Arc<RwLock<Peer>>>[src]

Gets the currently bound peer as as owning pointer

pub fn set_peer(&mut self, peer: &Arc<RwLock<Peer>>)[src]

Changes the peer of the session. If a peer was already set, it is unlinked

pub fn subs(&self) -> &HashSet<String>[src]

Returns the list of subscriptions

pub fn subscribe(&mut self, topic: &str) -> bool[src]

Creates a new subcription. If the topic was already used (replacement), returns false, otherwise true

Trait Implementations

impl Debug for Session[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.