diff options
| author | Zeyla Hellyer <[email protected]> | 2017-05-23 10:15:26 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-05-23 10:15:26 -0700 |
| commit | 8c0aeacadb93d3b56fb98beb882eaef1f79cd652 (patch) | |
| tree | 7c1d26addbf15537c6f69a6ac9623276002b155a /src/utils/colour.rs | |
| parent | Fix {Invite,RichInvite}::url tests (diff) | |
| download | serenity-8c0aeacadb93d3b56fb98beb882eaef1f79cd652.tar.xz serenity-8c0aeacadb93d3b56fb98beb882eaef1f79cd652.zip | |
Add more examples and improve some others
Add examples to some functions, and update some of the old examples to
use the `?` operator instead of unwrapping.
Diffstat (limited to 'src/utils/colour.rs')
| -rw-r--r-- | src/utils/colour.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/utils/colour.rs b/src/utils/colour.rs index 1a4e856..71fc25a 100644 --- a/src/utils/colour.rs +++ b/src/utils/colour.rs @@ -24,13 +24,24 @@ macro_rules! colour { /// Passing in a role's colour, and then retrieving its green component /// via [`g`]: /// -/// ```rust,ignore +/// ```rust +/// # use serenity::model::{Role, RoleId, permissions}; /// use serenity::utils::Colour; +/// # +/// # let role = Role { +/// # colour: Colour::blurple(), +/// # hoist: false, +/// # id: RoleId(1), +/// # managed: false, +/// # mentionable: false, +/// # name: "test".to_owned(), +/// # permissions: permissions::PRESET_GENERAL, +/// # position: 7, +/// # }; /// /// // assuming a `role` has already been bound /// -/// let colour = Colour::new(role.colour); -/// let green = colour.g(); +/// let green = role.colour.g(); /// /// println!("The green component is: {}", green); /// ``` @@ -45,7 +56,7 @@ macro_rules! colour { /// assert_eq!(colour.tuple(), (17, 128, 106)); /// ``` /// -/// Colours can also be directly compared for equivilance: +/// Colours can also be directly compared for equivalence: /// /// ```rust /// use serenity::utils::Colour; |