Skip to content

Instantly share code, notes, and snippets.

@griff
Created September 13, 2015 08:38
Show Gist options
  • Save griff/3e6ecf42740566c8db56 to your computer and use it in GitHub Desktop.
Save griff/3e6ecf42740566c8db56 to your computer and use it in GitHub Desktop.
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