aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authoralex <[email protected]>2017-06-14 18:26:01 +0200
committerZeyla Hellyer <[email protected]>2017-06-14 09:26:01 -0700
commit32e07e4ac822d5cc1118f0db0fc92b549c1aaf81 (patch)
treea4db15956faac92d544135de6885d64854a8b31d /src/framework
parentUse HTTPS Connector with remaining HTTP functions (diff)
downloadserenity-32e07e4ac822d5cc1118f0db0fc92b549c1aaf81.tar.xz
serenity-32e07e4ac822d5cc1118f0db0fc92b549c1aaf81.zip
Switch from #[doc(hidden)] to pub(crate)
Switch from using `#[doc(hidden)]` to hide some internal functions to `pub(crate)`. The library now requires rustc 1.18.
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/buckets.rs9
-rw-r--r--src/framework/command.rs11
-rw-r--r--src/framework/create_group.rs3
-rw-r--r--src/framework/mod.rs11
4 files changed, 14 insertions, 20 deletions
diff --git a/src/framework/buckets.rs b/src/framework/buckets.rs
index 4f24893..711c0fd 100644
--- a/src/framework/buckets.rs
+++ b/src/framework/buckets.rs
@@ -2,14 +2,12 @@ use chrono::UTC;
use std::collections::HashMap;
use std::default::Default;
-#[doc(hidden)]
-pub struct Ratelimit {
+pub(crate) struct Ratelimit {
pub delay: i64,
pub limit: Option<(i64, i32)>,
}
-#[doc(hidden)]
-pub struct MemberRatelimit {
+pub(crate) struct MemberRatelimit {
pub last_time: i64,
pub set_time: i64,
pub tickets: i32,
@@ -25,8 +23,7 @@ impl Default for MemberRatelimit {
}
}
-#[doc(hidden)]
-pub struct Bucket {
+pub(crate) struct Bucket {
pub ratelimit: Ratelimit,
pub users: HashMap<u64, MemberRatelimit>,
}
diff --git a/src/framework/command.rs b/src/framework/command.rs
index 6db228f..fcf039a 100644
--- a/src/framework/command.rs
+++ b/src/framework/command.rs
@@ -9,12 +9,10 @@ pub type Exec = Fn(&mut Context, &Message, Vec<String>) -> Result<(), String> +
pub type Help = Fn(&mut Context, &Message, HashMap<String, Arc<CommandGroup>>, &[String]) -> Result<(), String> + Send + Sync + 'static;
pub type BeforeHook = Fn(&mut Context, &Message, &String) -> bool + Send + Sync + 'static;
pub type AfterHook = Fn(&mut Context, &Message, &String, Result<(), String>) + Send + Sync + 'static;
-#[doc(hidden)]
-pub type InternalCommand = Arc<Command>;
+pub(crate) type InternalCommand = Arc<Command>;
pub type PrefixCheck = Fn(&mut Context, &Message) -> Option<String> + Send + Sync + 'static;
-#[doc(hidden)]
-pub enum CommandOrAlias {
+pub(crate) enum CommandOrAlias {
Alias(String),
Command(InternalCommand),
}
@@ -30,7 +28,7 @@ pub enum CommandType {
#[derive(Default)]
pub struct CommandGroup {
pub prefix: Option<String>,
- pub commands: HashMap<String, CommandOrAlias>,
+ pub(crate) commands: HashMap<String, CommandOrAlias>,
}
/// Command struct used to store commands internally.
@@ -64,8 +62,7 @@ pub struct Command {
pub guild_only: bool,
/// Whether command can only be used by owners or not.
pub owners_only: bool,
- #[doc(hidden)]
- pub aliases: Vec<String>,
+ pub(crate) aliases: Vec<String>,
}
impl Command {
diff --git a/src/framework/create_group.rs b/src/framework/create_group.rs
index cc0b3bd..88aa6ba 100644
--- a/src/framework/create_group.rs
+++ b/src/framework/create_group.rs
@@ -1,4 +1,5 @@
-pub use ext::framework::command::{Command, CommandType, CommandGroup, CommandOrAlias};
+pub use ext::framework::command::{Command, CommandType, CommandGroup};
+pub(crate) use ext::framework::command::CommandOrAlias;
pub use ext::framework::create_command::CreateCommand;
use std::default::Default;
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index 43d8fe4..671771f 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -62,8 +62,9 @@ mod create_command;
mod create_group;
mod buckets;
-pub use self::buckets::{Bucket, MemberRatelimit, Ratelimit};
-pub use self::command::{Command, CommandType, CommandGroup, CommandOrAlias};
+pub(crate) use self::buckets::{Bucket, Ratelimit};
+pub use self::command::{Command, CommandType, CommandGroup};
+pub(crate) use self::command::CommandOrAlias;
pub use self::configuration::Configuration;
pub use self::create_command::CreateCommand;
pub use self::create_group::CreateGroup;
@@ -450,8 +451,7 @@ impl Framework {
}
#[allow(cyclomatic_complexity)]
- #[doc(hidden)]
- pub fn dispatch(&mut self, mut context: Context, message: Message) {
+ pub(crate) fn dispatch(&mut self, mut context: Context, message: Message) {
let res = command::positions(&mut context, &message, &self.configuration);
let positions = match res {
@@ -798,8 +798,7 @@ impl Framework {
self
}
- #[doc(hidden)]
- pub fn update_current_user(&mut self, user_id: UserId, is_bot: bool) {
+ pub(crate) fn update_current_user(&mut self, user_id: UserId, is_bot: bool) {
self.user_info = (user_id.0, is_bot);
}