[−][src]Struct sage_broker::Session
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
Auto Trait Implementations
impl !RefUnwindSafe for Session
[src]
impl Send for Session
[src]
impl Sync for Session
[src]
impl Unpin for Session
[src]
impl !UnwindSafe for Session
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,