diff options
| author | Austin Hellyer <[email protected]> | 2016-11-10 20:25:32 -0700 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-12-29 11:55:10 -0800 |
| commit | 0359f512a8aada5ae0371049eb7c66ecd8d68d84 (patch) | |
| tree | f88dd9b362a2d349d0cdcd13b0859c4cc3329f46 /src/model/mod.rs | |
| parent | Rework some event handles (diff) | |
| download | serenity-0359f512a8aada5ae0371049eb7c66ecd8d68d84.tar.xz serenity-0359f512a8aada5ae0371049eb7c66ecd8d68d84.zip | |
Add guild and channel search
Diffstat (limited to 'src/model/mod.rs')
| -rw-r--r-- | src/model/mod.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/model/mod.rs b/src/model/mod.rs index 70fdd75..5aad290 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -128,7 +128,7 @@ id! { } /// A container for any channel. -#[derive(Debug, Clone)] +#[derive(Clone, Debug)] pub enum Channel { /// A group. A group comprises of only one channel. Group(Group), @@ -159,7 +159,7 @@ pub enum GuildContainer { /// This is for use with methods such as `Context::create_permission`. /// /// [`Context::create_permission`]: ../client/ -#[derive(Copy, Clone, Eq, PartialEq, Debug)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum PermissionOverwriteType { /// A member which is having its permission overwrites edited. Member(UserId), @@ -168,7 +168,7 @@ pub enum PermissionOverwriteType { } /// A guild which may or may not currently be available. -#[derive(Debug, Clone)] +#[derive(Clone, Debug)] pub enum PossibleGuild<T> { /// An indicator that a guild is currently unavailable for at least one of /// a variety of reasons. @@ -176,3 +176,21 @@ pub enum PossibleGuild<T> { /// An indicator that a guild is currently available. Online(T), } + +#[derive(Copy, Clone, Debug)] +pub enum SearchTarget { + Channel(ChannelId), + Guild(GuildId), +} + +impl From<ChannelId> for SearchTarget { + fn from(channel_id: ChannelId) -> SearchTarget { + SearchTarget::Channel(channel_id) + } +} + +impl From<GuildId> for SearchTarget { + fn from(guild_id: GuildId) -> SearchTarget { + SearchTarget::Guild(guild_id) + } +} |