Files
continuwuity/src/database/handle.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
431 B
Rust
Raw Normal View History

2024-07-02 05:56:10 +00:00
use std::ops::Deref;
use rocksdb::DBPinnableSlice;
pub struct Handle<'a> {
val: DBPinnableSlice<'a>,
}
impl<'a> From<DBPinnableSlice<'a>> for Handle<'a> {
fn from(val: DBPinnableSlice<'a>) -> Self {
Self {
val,
}
}
}
impl Deref for Handle<'_> {
type Target = [u8];
#[inline]
2024-07-02 05:56:10 +00:00
fn deref(&self) -> &Self::Target { &self.val }
}
impl AsRef<[u8]> for Handle<'_> {
#[inline]
2024-07-02 05:56:10 +00:00
fn as_ref(&self) -> &[u8] { &self.val }
}