Created
September 13, 2018 20:10
-
-
Save nemosupremo/7da00fe45162f56e74cee242bda5e656 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
let byte_offset = bit_idx / 8; | |
let byte = match val { | |
database::Value::String(s) => { | |
if byte_offset < s.len() { | |
s[byte_offset] | |
} | |
0 as u8 | |
}, | |
database::Value::Integer(i) => { | |
let s = &Bytes::from(i.to_string()); | |
if byte_offset < s.len() { | |
s[byte_offset] | |
} | |
0 as u8 | |
}, | |
_ => 0 return Err(Error::InvalidType) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment