diff options
| author | Austin Hellyer <[email protected]> | 2016-11-06 10:17:08 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-06 10:17:08 -0800 |
| commit | 8f145f223804b869df2304a64ce5d3d42c772226 (patch) | |
| tree | 285a7c187c876f9acd1eaf5c7031704209bcf01e /src/utils | |
| parent | Move HTTP/ratelimiting into a separate module (diff) | |
| download | serenity-8f145f223804b869df2304a64ce5d3d42c772226.tar.xz serenity-8f145f223804b869df2304a64ce5d3d42c772226.zip | |
Add some more documentation
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/colour.rs | 6 | ||||
| -rw-r--r-- | src/utils/message_builder.rs | 4 | ||||
| -rw-r--r-- | src/utils/mod.rs | 8 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/utils/colour.rs b/src/utils/colour.rs index 7bb7bfd..b9a3bf5 100644 --- a/src/utils/colour.rs +++ b/src/utils/colour.rs @@ -17,7 +17,7 @@ macro_rules! colour { /// as the API works with an integer value instead of an RGB value. /// /// Instances can be created by using the struct's associated functions. These -/// produce values equivilant to those found in the official client's colour +/// produce presets equivilant to those found in the official client's colour /// picker. /// /// # Examples @@ -36,12 +36,14 @@ macro_rules! colour { /// println!("The green component is: {}", green); /// ``` /// -/// Creating an instance with the [`dark_teal`] value: +/// Creating an instance with the [`dark_teal`] presets: /// /// ```rust,ignore /// use serenity::utils::Colour; /// /// let colour = Colour::dark_teal(); +/// +/// assert_eq!(colour.get_tuple(), (17, 128, 106)); /// ``` /// /// [`Role`]: ../model/struct.Role.html diff --git a/src/utils/message_builder.rs b/src/utils/message_builder.rs index 252d068..7ba7717 100644 --- a/src/utils/message_builder.rs +++ b/src/utils/message_builder.rs @@ -14,10 +14,12 @@ use ::model::{ChannelId, Emoji, Mentionable, RoleId, UserId}; /// ```rust,ignore /// use serenity::utils::MessageBuilder; /// +/// // assuming an `emoji` and `user` have already been bound +/// /// let content = MessageBuilder::new() /// .push("You sent a message, ") /// .mention(user) -/// .push("! "); +/// .push("! ") /// .mention(emoji) /// .build(); /// ``` diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 3ad6303..e6d2b4c 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -83,10 +83,12 @@ macro_rules! request { /// # Examples /// Retrieving the code from the URL `https://discord.gg/0cDvIgU2voY8RSYL`: /// -/// ```rust +/// ```rust,ignore /// use serenity::utils; /// -/// assert!(utils::parse_invite("https://discord.gg/0cDvIgU2voY8RSYL") == "0cDvIgU2voY8RSYL"); +/// let url = "https://discord.gg/0cDvIgU2voY8RSYL"; +/// +/// assert!(utils::parse_invite(url) == "0cDvIgU2voY8RSYL"); /// ``` /// /// [`RichInvite`]: ../model/struct.RichInvite.html @@ -117,6 +119,8 @@ pub fn parse_invite(code: &str) -> &str { /// Ok(image) => image, /// Err(why) => { /// // properly handle the error +/// +/// return; /// }, /// }; /// ``` |