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)
Expand description
A private channel to another User
. No other users may access the
channel. For multi-user “private channels”, use a group.
Category(ChannelCategory)
Expand description
A category of GuildChannel
s
Implementations
impl Channel
[src]
impl Channel
[src]pub fn guild(self) -> Option<GuildChannel>
[src]
pub fn guild(self) -> Option<GuildChannel>
[src]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!"); }, }
pub fn private(self) -> Option<PrivateChannel>
[src]
pub fn private(self) -> Option<PrivateChannel>
[src]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!"); }, }
pub fn category(self) -> Option<ChannelCategory>
[src]
pub fn category(self) -> Option<ChannelCategory>
[src]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!"); }, }
pub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
[src]
pub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
[src]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.
pub fn id(&self) -> ChannelId
[src]
pub fn id(&self) -> ChannelId
[src]Retrieves the Id of the inner GuildChannel
, or
PrivateChannel
.
pub fn position(&self) -> Option<i64>
[src]
pub fn position(&self) -> Option<i64>
[src]Retrieves the position of the inner GuildChannel
or
ChannelCategory
.
If other channel types are used it will return None.
Trait Implementations
impl<'de> Deserialize<'de> for Channel
[src]
impl<'de> Deserialize<'de> for Channel
[src]fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]Deserialize this value from the given Serde deserializer. Read more
impl Display for Channel
[src]
impl Display for Channel
[src]fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
[src]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.
impl FromStrAndCache for Channel
[src]
impl FromStrAndCache for Channel
[src]impl Mentionable for Channel
[src]
impl Mentionable for Channel
[src]Auto Trait Implementations
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 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<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,