aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-07-08 10:37:09 -0700
committerZeyla Hellyer <[email protected]>2018-07-08 10:37:09 -0700
commit9e456427ccd496c4128bde841df0c0af7a262047 (patch)
tree09c23bfb693494e9a9495b63ed4a9a0904bc173f /src
parentAdd associated consts in Colour, deprecate methods (diff)
downloadserenity-9e456427ccd496c4128bde841df0c0af7a262047.tar.xz
serenity-9e456427ccd496c4128bde841df0c0af7a262047.zip
impl Form<&$ID> for $ID
Implements `From<&Id>` for all `Id` types, e.g. `From<&RoleId> for RoleId`.
Diffstat (limited to 'src')
-rw-r--r--src/model/id.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/model/id.rs b/src/model/id.rs
index 4e2fbc3..046de11 100644
--- a/src/model/id.rs
+++ b/src/model/id.rs
@@ -27,6 +27,12 @@ macro_rules! id_u64 {
}
}
+ impl<'a> From<&'a $name> for $name {
+ fn from(id: &'a $name) -> $name {
+ id.clone()
+ }
+ }
+
impl From<u64> for $name {
fn from(id_as_u64: u64) -> $name {
$name(id_as_u64)