pub struct ChannelInfo {
pub name: String,
pub channel_type: ChannelType,
pub subscribers: HashSet<String>,
pub members: Vec<PresenceMember>,
}Expand description
Information about a channel.
Fields§
§name: StringChannel name.
channel_type: ChannelTypeChannel type.
subscribers: HashSet<String>Connected client socket IDs.
members: Vec<PresenceMember>Presence members (for presence channels).
Implementations§
Source§impl ChannelInfo
impl ChannelInfo
Sourcepub fn new(name: impl Into<String>) -> ChannelInfo
pub fn new(name: impl Into<String>) -> ChannelInfo
Create a new channel.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get subscriber count.
Sourcepub fn add_subscriber(&mut self, socket_id: String) -> bool
pub fn add_subscriber(&mut self, socket_id: String) -> bool
Add a subscriber.
Sourcepub fn remove_subscriber(&mut self, socket_id: &str) -> bool
pub fn remove_subscriber(&mut self, socket_id: &str) -> bool
Remove a subscriber.
Sourcepub fn add_member(&mut self, member: PresenceMember)
pub fn add_member(&mut self, member: PresenceMember)
Add a presence member.
Sourcepub fn remove_member(&mut self, socket_id: &str) -> Option<PresenceMember>
pub fn remove_member(&mut self, socket_id: &str) -> Option<PresenceMember>
Remove a presence member by socket ID.
Sourcepub fn get_members(&self) -> &[PresenceMember]
pub fn get_members(&self) -> &[PresenceMember]
Get presence members.
Trait Implementations§
Source§impl Clone for ChannelInfo
impl Clone for ChannelInfo
Source§fn clone(&self) -> ChannelInfo
fn clone(&self) -> ChannelInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChannelInfo
impl RefUnwindSafe for ChannelInfo
impl Send for ChannelInfo
impl Sync for ChannelInfo
impl Unpin for ChannelInfo
impl UnsafeUnpin for ChannelInfo
impl UnwindSafe for ChannelInfo
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