mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-29 19:28:31 +00:00
26 lines
409 B
Rust
26 lines
409 B
Rust
|
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];
|
||
|
|
||
|
fn deref(&self) -> &Self::Target { &self.val }
|
||
|
}
|
||
|
|
||
|
impl AsRef<[u8]> for Handle<'_> {
|
||
|
fn as_ref(&self) -> &[u8] { &self.val }
|
||
|
}
|