aboutsummaryrefslogtreecommitdiff
path: root/src/http
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/http
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/http')
-rw-r--r--src/http/mod.rs7
-rw-r--r--src/http/ratelimiting.rs9
2 files changed, 6 insertions, 10 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 90869d6..b8a40ca 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -80,8 +80,8 @@ lazy_static! {
/// Sets the token to be used across all requests which require authentication.
///
-/// This is really only for internal use, and if you are reading this as a user,
-/// you should _not_ use this yourself.
+/// This is intended for internal use! The only exception are webhooks.
+/// But really, please don't use this.
#[doc(hidden)]
pub fn set_token(token: &str) {
TOKEN.lock().unwrap().clone_from(&token.to_owned());
@@ -1583,8 +1583,7 @@ fn request<'a, F>(route: Route, f: F) -> Result<HyperResponse>
}
}
-#[doc(hidden)]
-pub fn retry<'a, F>(f: F) -> HyperResult<HyperResponse>
+pub(crate) fn retry<'a, F>(f: F) -> HyperResult<HyperResponse>
where F: Fn() -> RequestBuilder<'a> {
let req = || f()
.header(header::UserAgent(constants::USER_AGENT.to_owned()))
diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs
index d290dd0..dd56d6d 100644
--- a/src/http/ratelimiting.rs
+++ b/src/http/ratelimiting.rs
@@ -340,8 +340,7 @@ pub enum Route {
None,
}
-#[doc(hidden)]
-pub fn perform<'a, F>(route: Route, f: F) -> Result<Response>
+pub(crate) fn perform<'a, F>(route: Route, f: F) -> Result<Response>
where F: Fn() -> RequestBuilder<'a> {
loop {
// This will block if another thread already has the global
@@ -435,8 +434,7 @@ pub struct RateLimit {
}
impl RateLimit {
- #[doc(hidden)]
- pub fn pre_hook(&mut self, route: &Route) {
+ pub(crate) fn pre_hook(&mut self, route: &Route) {
if self.limit == 0 {
return;
}
@@ -464,8 +462,7 @@ impl RateLimit {
self.remaining -= 1;
}
- #[doc(hidden)]
- pub fn post_hook(&mut self, response: &Response, route: &Route) -> Result<bool> {
+ pub(crate) fn post_hook(&mut self, response: &Response, route: &Route) -> Result<bool> {
if let Some(limit) = parse_header(&response.headers, "x-ratelimit-limit")? {
self.limit = limit;
}