diff options
Diffstat (limited to 'users/edef/weave/src/bytes.rs')
-rw-r--r-- | users/edef/weave/src/bytes.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/users/edef/weave/src/bytes.rs b/users/edef/weave/src/bytes.rs deleted file mode 100644 index 689b8fdfc0c8..000000000000 --- a/users/edef/weave/src/bytes.rs +++ /dev/null @@ -1,27 +0,0 @@ -use owning_ref::{OwningRef, StableAddress}; -use polars::export::arrow::buffer::Buffer; -use std::ops::Deref; - -/// An shared `[[u8; N]]` backed by a Polars [Buffer]. -pub type FixedBytes<const N: usize> = OwningRef<'static, Bytes, [[u8; N]]>; - -/// Wrapper struct to make [Buffer] implement [StableAddress]. -/// TODO(edef): upstream the `impl` -pub struct Bytes(pub Buffer<u8>); - -/// SAFETY: [Buffer] is always an Arc+Vec indirection. -unsafe impl StableAddress for Bytes {} - -impl Bytes { - pub fn map<U: ?Sized>(self, f: impl FnOnce(&[u8]) -> &U) -> OwningRef<'static, Self, U> { - OwningRef::new(self).map(f) - } -} - -impl Deref for Bytes { - type Target = [u8]; - - fn deref(&self) -> &Self::Target { - &*self.0 - } -} |