aboutsummaryrefslogtreecommitdiff
path: root/src/model/webhook.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-27 06:42:48 +0200
committeracdenisSK <[email protected]>2017-07-27 07:30:23 +0200
commit550030264952f0e0043b63f4582bb817ef8bbf37 (patch)
treeb921e2f78fd603a5ca671623083a32806fd16090 /src/model/webhook.rs
parentUse a consistent indentation style (diff)
downloadserenity-550030264952f0e0043b63f4582bb817ef8bbf37.tar.xz
serenity-550030264952f0e0043b63f4582bb817ef8bbf37.zip
rustfmt
Diffstat (limited to 'src/model/webhook.rs')
-rw-r--r--src/model/webhook.rs48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/model/webhook.rs b/src/model/webhook.rs
index a858589..9422d46 100644
--- a/src/model/webhook.rs
+++ b/src/model/webhook.rs
@@ -1,13 +1,13 @@
use super::*;
-#[cfg(feature="model")]
+#[cfg(feature = "model")]
use std::mem;
-#[cfg(feature="model")]
-use ::builder::ExecuteWebhook;
-#[cfg(feature="model")]
-use ::internal::prelude::*;
-#[cfg(feature="model")]
-use ::http;
+#[cfg(feature = "model")]
+use builder::ExecuteWebhook;
+#[cfg(feature = "model")]
+use internal::prelude::*;
+#[cfg(feature = "model")]
+use http;
/// A representation of a webhook, which is a low-effort way to post messages to
/// channels. They do not necessarily require a bot user or authentication to
@@ -42,7 +42,7 @@ pub struct Webhook {
pub user: Option<User>,
}
-#[cfg(feature="model")]
+#[cfg(feature = "model")]
impl Webhook {
/// Deletes the webhook.
///
@@ -51,9 +51,7 @@ impl Webhook {
///
/// [`http::delete_webhook_with_token`]: ../http/fn.delete_webhook_with_token.html
#[inline]
- pub fn delete(&self) -> Result<()> {
- http::delete_webhook_with_token(self.id.0, &self.token)
- }
+ pub fn delete(&self) -> Result<()> { http::delete_webhook_with_token(self.id.0, &self.token) }
///
/// Edits the webhook in-place. All fields are optional.
@@ -109,11 +107,12 @@ impl Webhook {
let mut map = Map::new();
if let Some(avatar) = avatar {
- map.insert("avatar".to_owned(), if avatar.is_empty() {
- Value::Null
- } else {
- Value::String(avatar.to_owned())
- });
+ map.insert("avatar".to_owned(),
+ if avatar.is_empty() {
+ Value::Null
+ } else {
+ Value::String(avatar.to_owned())
+ });
}
if let Some(name) = name {
@@ -178,9 +177,14 @@ impl Webhook {
/// .expect("Error executing");
/// ```
#[inline]
- pub fn execute<F: FnOnce(ExecuteWebhook) -> ExecuteWebhook>(&self, wait: bool, f: F)
- -> Result<Option<Message>> {
- http::execute_webhook(self.id.0, &self.token, wait, &f(ExecuteWebhook::default()).0)
+ pub fn execute<F: FnOnce(ExecuteWebhook) -> ExecuteWebhook>(&self,
+ wait: bool,
+ f: F)
+ -> Result<Option<Message>> {
+ http::execute_webhook(self.id.0,
+ &self.token,
+ wait,
+ &f(ExecuteWebhook::default()).0)
}
/// Retrieves the latest information about the webhook, editing the
@@ -202,7 +206,7 @@ impl Webhook {
}
}
-#[cfg(feature="model")]
+#[cfg(feature = "model")]
impl WebhookId {
/// Retrieves the webhook by the Id.
///
@@ -210,7 +214,5 @@ impl WebhookId {
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
- pub fn get(&self) -> Result<Webhook> {
- http::get_webhook(self.0)
- }
+ pub fn get(&self) -> Result<Webhook> { http::get_webhook(self.0) }
}