pub struct ChannelManager { /* private fields */ }Expand description
Manages channel lifecycle, membership, and state transitions.
Implementations§
Source§impl ChannelManager
impl ChannelManager
Sourcepub fn create(
&mut self,
name: &str,
channel_type: ChannelType,
config: Option<ChannelConfig>,
) -> CommResult<&Channel>
pub fn create( &mut self, name: &str, channel_type: ChannelType, config: Option<ChannelConfig>, ) -> CommResult<&Channel>
Create a new channel and return a reference to it.
Sourcepub fn get_mut(&mut self, id: u64) -> Option<&mut Channel>
pub fn get_mut(&mut self, id: u64) -> Option<&mut Channel>
Get a mutable reference to a channel by id.
Sourcepub fn join(&mut self, channel_id: u64, agent_id: &str) -> CommResult<()>
pub fn join(&mut self, channel_id: u64, agent_id: &str) -> CommResult<()>
Add a participant to a channel.
Sourcepub fn leave(&mut self, channel_id: u64, agent_id: &str) -> CommResult<()>
pub fn leave(&mut self, channel_id: u64, agent_id: &str) -> CommResult<()>
Remove a participant from a channel.
Sourcepub fn close(&mut self, channel_id: u64) -> CommResult<()>
pub fn close(&mut self, channel_id: u64) -> CommResult<()>
Close a channel (sets state to ChannelState::Closed).
Sourcepub fn set_state(
&mut self,
channel_id: u64,
state: ChannelState,
) -> CommResult<()>
pub fn set_state( &mut self, channel_id: u64, state: ChannelState, ) -> CommResult<()>
Transition a channel to a new state.
Sourcepub fn set_config(
&mut self,
channel_id: u64,
config: ChannelConfig,
) -> CommResult<()>
pub fn set_config( &mut self, channel_id: u64, config: ChannelConfig, ) -> CommResult<()>
Update the configuration of a channel.
Sourcepub fn channels(&self) -> &HashMap<u64, Channel>
pub fn channels(&self) -> &HashMap<u64, Channel>
Immutable access to the underlying channel map.
Sourcepub fn channels_mut(&mut self) -> &mut HashMap<u64, Channel>
pub fn channels_mut(&mut self) -> &mut HashMap<u64, Channel>
Mutable access to the underlying channel map.
Trait Implementations§
Source§impl Clone for ChannelManager
impl Clone for ChannelManager
Source§fn clone(&self) -> ChannelManager
fn clone(&self) -> ChannelManager
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 ChannelManager
impl Debug for ChannelManager
Source§impl Default for ChannelManager
impl Default for ChannelManager
Source§fn default() -> ChannelManager
fn default() -> ChannelManager
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChannelManager
impl<'de> Deserialize<'de> for ChannelManager
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChannelManager
impl RefUnwindSafe for ChannelManager
impl Send for ChannelManager
impl Sync for ChannelManager
impl Unpin for ChannelManager
impl UnsafeUnpin for ChannelManager
impl UnwindSafe for ChannelManager
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