pub struct HexPrefix { /* private fields */ }
Implementations§
source§impl HexPrefix
impl HexPrefix
pub fn new(prefix: &str) -> Option<HexPrefix>
pub fn from_bytes(bytes: &[u8]) -> Self
pub fn hex(&self) -> String
sourcepub fn min_prefix_bytes(&self) -> &[u8] ⓘ
pub fn min_prefix_bytes(&self) -> &[u8] ⓘ
Minimum bytes that would match this prefix. (e.g. “abc0” for “abc”)
Use this to partition a sorted slice, and test matches(id)
from there.
sourcepub fn as_full_bytes(&self) -> Option<&[u8]>
pub fn as_full_bytes(&self) -> Option<&[u8]>
Returns the bytes representation if this prefix can be a full id.
pub fn matches<Q: ObjectId>(&self, id: &Q) -> bool
Trait Implementations§
source§impl PartialEq for HexPrefix
impl PartialEq for HexPrefix
impl Eq for HexPrefix
impl StructuralPartialEq for HexPrefix
Auto Trait Implementations§
impl RefUnwindSafe for HexPrefix
impl Send for HexPrefix
impl Sync for HexPrefix
impl Unpin for HexPrefix
impl UnwindSafe for HexPrefix
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more