Created
September 13, 2015 08:38
-
-
Save griff/3e6ecf42740566c8db56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct EventKey { | |
event_id: u64 | |
} | |
impl ToMdbValue for EventKey { | |
fn to_mdb_value(&self) -> MdbValue { | |
let mut key : Vec<u8> = "events:".as_bytes().to_vec(); | |
let mut buf = [0; 8]; | |
BigEndian::write_u64(&mut buf, self.event_id); | |
for n in &buf { | |
key.push(*n); | |
} | |
return key.to_mdb_value(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment