chore(tvix/tools): move weave to //users/edef

This is not a core Tvix tool, it's a tool that uses a Tvix component.

Change-Id: I705f2c4ab87f1512e005007c933e16b84ed4279f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12605
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2024-10-13 01:57:58 +03:00 committed by clbot
parent bd8d6e824f
commit bb34210a64
9 changed files with 3 additions and 3 deletions

View file

@ -0,0 +1,27 @@
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<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<Self, U> {
OwningRef::new(self).map(f)
}
}
impl Deref for Bytes {
type Target = [u8];
fn deref(&self) -> &Self::Target {
&*self.0
}
}