diff options
| author | Austin Hellyer <[email protected]> | 2016-11-18 11:00:45 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-18 11:00:45 -0800 |
| commit | cf128b1a10d0636c8b4b5233d46b068cfe665688 (patch) | |
| tree | f36b1cd08d00cec69a76eb10c493ab3b86d61678 /src/utils/mod.rs | |
| parent | Feature macros should use else as block separator (diff) | |
| download | serenity-cf128b1a10d0636c8b4b5233d46b068cfe665688.tar.xz serenity-cf128b1a10d0636c8b4b5233d46b068cfe665688.zip | |
A bit of docs
Diffstat (limited to 'src/utils/mod.rs')
| -rw-r--r-- | src/utils/mod.rs | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index ccf7787..cb97a58 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -93,14 +93,37 @@ pub fn into_array(value: Value) -> Result<Vec<Value>> { /// Retrieves the "code" part of an [invite][`RichInvite`] out of a URL. /// /// # Examples -/// Retrieving the code from the URL `https://discord.gg/0cDvIgU2voY8RSYL`: /// -/// ```rust,ignore +/// Three formats of codes are supported: +/// +/// 1. Retrieving the code from the URL `"https://discord.gg/0cDvIgU2voY8RSYL"`: +/// +/// ```rust /// use serenity::utils; /// /// let url = "https://discord.gg/0cDvIgU2voY8RSYL"; /// -/// assert!(utils::parse_invite(url) == "0cDvIgU2voY8RSYL"); +/// assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL"); +/// ``` +/// +/// 2. Retrieving the code from the URL `"http://discord.gg/0cDvIgU2voY8RSYL"`: +/// +/// ```rust +/// use serenity::utils; +/// +/// let url = "http://discord.gg/0cDvIgU2voY8RSYL"; +/// +/// assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL"); +/// ``` +/// +/// 3. Retrieving the code from the URL `"discord.gg/0cDvIgU2voY8RSYL"`: +/// +/// ```rust +/// use serenity::utils; +/// +/// let url = "discord.gg/0cDvIgU2voY8RSYL"; +/// +/// assert_eq!(utils::parse_invite(url), "0cDvIgU2voY8RSYL"); /// ``` /// /// [`RichInvite`]: ../model/struct.RichInvite.html @@ -124,7 +147,7 @@ pub fn parse_invite(code: &str) -> &str { /// /// Reads an image located at `./cat.png` into a base64-encoded string: /// -/// ```rust,ignore +/// ```rust,no_run /// use serenity::utils; /// /// let image = match utils::read_image("./cat.png") { |