[−][src]Enum serenity::model::channel::Channel
A container for any channel.
Variants (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
impl Channel
[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]
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]
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]
Deletes the inner channel.
Note: If the cache
-feature is enabled permissions will be checked and upon
owning the required permissions the HTTP-request will be issued.
pub fn is_nsfw(&self) -> bool
[src]
Determines if the channel is NSFW.
pub fn id(&self) -> ChannelId
[src]
Retrieves the Id of the inner GuildChannel
, or
PrivateChannel
.
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 Clone for Channel
[src]
impl Debug for Channel
[src]
impl<'de> Deserialize<'de> for Channel
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
deserializer: D
) -> StdResult<Self, D::Error>
impl Display for Channel
[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<'a> From<&'a Channel> for ChannelId
[src]
impl From<Channel> for ChannelId
[src]
impl FromStrAndCache for Channel
[src]
type Err = ChannelParseError
fn from_str<'life0, 'async_trait, C>(
cache: C,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = StdResult<Self, Self::Err>> + Send + 'async_trait>> where
C: AsRef<Cache> + Send + Sync,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
cache: C,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = StdResult<Self, Self::Err>> + Send + 'async_trait>> where
C: AsRef<Cache> + Send + Sync,
C: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
impl Mentionable for Channel
[src]
impl Serialize 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<F> FromStrAndCache for F where
F: FromStr,
[src]
F: FromStr,
type Err = <F as FromStr>::Err
fn from_str<'life0, 'async_trait, CRL>(
CRL,
&'life0 str
) -> Pin<Box<dyn Future<Output = Result<F, <F as FromStrAndCache>::Err>> + 'async_trait + Send>> where
'life0: 'async_trait,
CRL: AsRef<Cache> + Send + Sync + 'async_trait,
F: 'async_trait,
[src]
CRL,
&'life0 str
) -> Pin<Box<dyn Future<Output = Result<F, <F as FromStrAndCache>::Err>> + 'async_trait + Send>> where
'life0: 'async_trait,
CRL: AsRef<Cache> + Send + Sync + 'async_trait,
F: 'async_trait,
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,