Enum serenity::model::channel::Channel [−][src]
#[non_exhaustive] pub enum Channel { Guild(GuildChannel), Private(PrivateChannel), Category(ChannelCategory), }
Expand description
A container for any channel.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Guild(GuildChannel)
Private(PrivateChannel)
A private channel to another User
. No other users may access the
channel. For multi-user “private channels”, use a group.
Category(ChannelCategory)
A category of GuildChannel
s
Implementations
Converts from Channel
to Option<GuildChannel>
.
Converts self
into an Option<GuildChannel>
, consuming
self
, and discarding a PrivateChannel
, or
ChannelCategory
, if any.
Examples
Basic usage:
match channel.guild() { Some(guild) => { println!("It's a guild named {}!", guild.name); }, None => { println!("It's not a guild!"); }, }
Converts from Channel
to Option<PrivateChannel>
.
Converts self
into an Option<PrivateChannel>
, consuming
self
, and discarding a GuildChannel
, or ChannelCategory
,
if any.
Examples
Basic usage:
match channel.private() { Some(private) => { println!("It's a private channel with {}!", &private.recipient); }, None => { println!("It's not a private channel!"); }, }
Converts from Channel
to Option<ChannelCategory>
.
Converts self
into an Option<ChannelCategory>
,
consuming self
, and discarding a GuildChannel
, or
PrivateChannel
, if any.
Examples
Basic usage:
match channel.category() { Some(category) => { println!("It's a category named {}!", category.name); }, None => { println!("It's not a category!"); }, }
Deletes the inner channel.
Errors
If the cache
is enabled, returns ModelError::InvalidPermissions
,
if the current user lacks permission.
Otherwise will return Error::Http
if the current user does not
have permission.
Retrieves the Id of the inner GuildChannel
, or
PrivateChannel
.
Retrieves the position of the inner GuildChannel
or
ChannelCategory
.
If other channel types are used it will return None.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
Formats the channel into a “mentioned” string.
This will return a different format for each type of channel:
PrivateChannel
s: the recipient’s name;GuildChannel
s: a string mentioning the channel that users who can see the channel can click on.
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl UnwindSafe for Channel
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V