[−][src]Struct serenity::voice::Manager
A manager is a struct responsible for managing Handler
s which belong to
a single Shard
. This is a fairly complex key-value store,
with a bit of extra utility for easily joining a "target".
The "target" used by the Manager is determined based on the guild_id
and
channel_id
provided. If a guild_id
is not provided to methods that
optionally require it, then the target is a group or 1-on-1 call with a
user. The channel_id
is then used as the target.
If a guild_id
is provided, then the target is the guild, as a user
can not be connected to two channels within one guild simultaneously.
Methods
impl Manager
[src]
impl Manager
pub fn get<G: Into<GuildId>>(&self, guild_id: G) -> Option<&Handler>
[src]
pub fn get<G: Into<GuildId>>(&self, guild_id: G) -> Option<&Handler>
Retrieves an immutable handler for the given target, if one exists.
pub fn get_mut<G: Into<GuildId>>(&mut self, guild_id: G) -> Option<&mut Handler>
[src]
pub fn get_mut<G: Into<GuildId>>(&mut self, guild_id: G) -> Option<&mut Handler>
Retrieves a mutable handler for the given target, if one exists.
pub fn join<C, G>(&mut self, guild_id: G, channel_id: C) -> &mut Handler where
C: Into<ChannelId>,
G: Into<GuildId>,
[src]
pub fn join<C, G>(&mut self, guild_id: G, channel_id: C) -> &mut Handler where
C: Into<ChannelId>,
G: Into<GuildId>,
Connects to a target by retrieving its relevant Handler
and
connecting, or creating the handler if required.
This can also switch to the given channel, if a handler already exists for the target and the current connected channel is not equal to the given channel.
In the case of channel targets, the same channel is used to connect to.
In the case of guilds, the provided channel is used to connect to. The channel must be in the provided guild. This is not checked by the library, and will result in an error. If there is already a connected handler for the guild, and the provided channel is different from the channel that the connection is already connected to, then the handler will switch the connection to the provided channel.
If you only need to retrieve the handler for a target, then use
get
.
pub fn leave<G: Into<GuildId>>(&mut self, guild_id: G)
[src]
pub fn leave<G: Into<GuildId>>(&mut self, guild_id: G)
Retrieves the handler for the given target and leaves the associated voice channel, if connected.
This will not drop the handler, and will preserve it and its settings.
This is a wrapper around getting a handler and calling
leave
on it.
pub fn remove<G: Into<GuildId>>(&mut self, guild_id: G)
[src]
pub fn remove<G: Into<GuildId>>(&mut self, guild_id: G)
Retrieves the Handler
for the given target and leaves the associated
voice channel, if connected.
The handler is then dropped, removing settings for the target.
Trait Implementations
impl Clone for Manager
[src]
impl Clone for Manager
fn clone(&self) -> Manager
[src]
fn clone(&self) -> Manager
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Manager
[src]
impl Debug for Manager
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
impl<T> Erased for T
impl<T> Typeable for T where
T: Any,
impl<T> Typeable for T where
T: Any,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
[src]
impl<T> CloneAny for T where
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
[src]
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
[src]
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
[src]
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
[src]
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,