aboutsummaryrefslogtreecommitdiff
path: root/src/model/mod.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-05 14:12:53 +0200
committerZeyla Hellyer <[email protected]>2017-10-09 15:48:18 -0700
commite0e76173f63b6071b9df3ff8f53371b4b6c4ee1e (patch)
tree26e8e3518471a96e6b8f82cf167ffe758b07300a /src/model/mod.rs
parentReplace slice parametres by IntoIterator (#177) (diff)
downloadserenity-e0e76173f63b6071b9df3ff8f53371b4b6c4ee1e.tar.xz
serenity-e0e76173f63b6071b9df3ff8f53371b4b6c4ee1e.zip
Use an as_ref hack
Diffstat (limited to 'src/model/mod.rs')
-rw-r--r--src/model/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/model/mod.rs b/src/model/mod.rs
index 6b6d9bf..5eae177 100644
--- a/src/model/mod.rs
+++ b/src/model/mod.rs
@@ -61,6 +61,13 @@ macro_rules! id_u64 {
}
}
+ // This is a hack so that functions can accept `IntoIterator<Item=IdType>`, or `IntoIterator<Item=&IdType>`
+ impl AsRef<$name> for $name {
+ fn as_ref(&self) -> &Self {
+ self
+ }
+ }
+
impl From<u64> for $name {
fn from(id_as_u64: u64) -> $name {
$name(id_as_u64)