Skip to content

Commit

Permalink
impl Form<&$ID> for $ID
Browse files Browse the repository at this point in the history
Implements `From<&Id>` for all `Id` types, e.g. `From<&RoleId> for RoleId`.
  • Loading branch information
Zeyla Hellyer committed Jul 8, 2018
1 parent bbfc8e2 commit 9e45642
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/model/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9e45642

Please sign in to comment.