[−][src]Enum serenity::model::channel::Channel
A container for any channel.
Variants
Group(Arc<RwLock<Group>>)
A group. A group comprises of only one channel.
Guild(Arc<RwLock<GuildChannel>>)
Private(Arc<RwLock<PrivateChannel>>)
A private channel to another User
. No other users may access the
channel. For multi-user "private channels", use a group.
Category(Arc<RwLock<ChannelCategory>>)
A category of GuildChannel
s
Methods
impl Channel
[src]
pub fn group(self) -> Option<Arc<RwLock<Group>>>
[src]
Converts from Channel
to Option<Arc<RwLock<Group>>>
.
Converts self
into an Option<Arc<RwLock<Group>>>
, consuming self
,
and discarding a GuildChannel
, PrivateChannel
, or ChannelCategory
,
if any.
Examples
Basic usage:
match channel.group() { Some(group_lock) => { if let Some(ref name) = group_lock.read().name { println!("It's a group named {}!", name); } else { println!("It's an unnamed group!"); } }, None => { println!("It's not a group!"); }, } fn main() {}
pub fn guild(self) -> Option<Arc<RwLock<GuildChannel>>>
[src]
Converts from Channel
to Option<Arc<RwLock<GuildChannel>>>
.
Converts self
into an Option<Arc<RwLock<GuildChannel>>>
, consuming
self
, and discarding a Group
, PrivateChannel
, or
ChannelCategory
, if any.
Examples
Basic usage:
match channel.guild() { Some(guild_lock) => { println!("It's a guild named {}!", guild_lock.read().name); }, None => { println!("It's not a guild!"); }, } fn main() {}
pub fn private(self) -> Option<Arc<RwLock<PrivateChannel>>>
[src]
Converts from Channel
to Option<Arc<RwLock<PrivateChannel>>>
.
Converts self
into an Option<Arc<RwLock<PrivateChannel>>>
, consuming
self
, and discarding a Group
, GuildChannel
, or ChannelCategory
,
if any.
Examples
Basic usage:
match channel.private() { Some(private_lock) => { let private = private_lock.read(); let recipient_lock = &private.recipient; let recipient = recipient_lock.read(); println!("It's a private channel with {}!", recipient.name); }, None => { println!("It's not a private channel!"); }, } fn main() {}
pub fn category(self) -> Option<Arc<RwLock<ChannelCategory>>>
[src]
Converts from Channel
to Option<Arc<RwLock<ChannelCategory>>>
.
Converts self
into an Option<Arc<RwLock<ChannelCategory>>>
,
consuming self
, and discarding a Group
, GuildChannel
, or
PrivateChannel
, if any.
Examples
Basic usage:
match channel.category() { Some(category_lock) => { println!("It's a category named {}!", category_lock.read().name); }, None => { println!("It's not a category!"); }, } fn main() {}
pub 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.
Note: There is no real function as deleting a Group
. The
closest functionality is leaving it.
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 Group
, 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 Mentionable for Channel
[src]
impl FromStrAndCache for Channel
[src]
type Err = ChannelParseError
fn from_str(
cache: impl AsRef<CacheRwLock>,
s: &str
) -> StdResult<Self, Self::Err>
[src]
cache: impl AsRef<CacheRwLock>,
s: &str
) -> StdResult<Self, Self::Err>
impl From<Channel> for ChannelId
[src]
impl<'a> From<&'a Channel> for ChannelId
[src]
impl Clone for Channel
[src]
fn clone(&self) -> Channel
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Channel
[src]
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:
Group
s: the generated name retrievable viaGroup::name
;PrivateChannel
s: the recipient's name;GuildChannel
s: a string mentioning the channel that users who can see the channel can click on.
impl Serialize 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>
Auto Trait Implementations
impl Send for Channel
impl Unpin for Channel
impl Sync for Channel
impl !UnwindSafe for Channel
impl !RefUnwindSafe for Channel
Blanket Implementations
impl<F> FromStrAndCache for F where
F: FromStr,
[src]
F: FromStr,
type Err = <F as FromStr>::Err
fn from_str<impl AsRef>(
impl AsRef,
&str
) -> Result<F, <F as FromStrAndCache>::Err> where
impl AsRef: AsRef<CacheRwLock>,
[src]
impl AsRef
&str
) -> Result<F, <F as FromStrAndCache>::Err> where
impl AsRef
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
[src]
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
[src]
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
[src]
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
T: Any,