aboutsummaryrefslogtreecommitdiff
path: root/src/model/id.rs
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-08-12 21:43:59 +0200
committerzeyla <[email protected]>2018-08-12 12:43:59 -0700
commit71edc3a11ac450728bca19ca7cab7c84079d59f0 (patch)
treebc6197f96ba9118ffa0b104c8434585d38bb6032 /src/model/id.rs
parentRevert "Send silence frames upon connection (Fix #301)" (diff)
downloadserenity-71edc3a11ac450728bca19ca7cab7c84079d59f0.tar.xz
serenity-71edc3a11ac450728bca19ca7cab7c84079d59f0.zip
Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypes
Diffstat (limited to 'src/model/id.rs')
-rw-r--r--src/model/id.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/model/id.rs b/src/model/id.rs
index 5ec5c75..a153d3b 100644
--- a/src/model/id.rs
+++ b/src/model/id.rs
@@ -16,6 +16,18 @@ macro_rules! id_u64 {
NaiveDateTime::from_timestamp(1_420_070_400 + offset as i64, 0)
}
+
+ /// Immutably borrow inner Id.
+ #[inline]
+ pub fn as_u64(&self) -> &u64 {
+ &self.0
+ }
+
+ /// Mutably borrow inner Id.
+ #[inline]
+ pub fn as_mut_u64(&mut self) -> &mut u64 {
+ &mut self.0
+ }
}
// This is a hack so functions can accept iterators that either: