pub enum Stash<C, B> {
Typed(C),
Bytes(B),
Align(Box<[u64]>),
}Expand description
A container of either typed columns, or serialized bytes that can be borrowed as the former.
When B dereferences to a byte slice, the container can be borrowed as if the container type C.
This container inherents the readable properties of C through borrowing, but does not implement
the traits itself.
The container can be cleared and pushed into. When cleared it reverts to a typed variant, and when pushed into if the typed variant it will accept the item, and if not it will panic.
Variants§
Typed(C)
The typed variant of the container.
Bytes(B)
The bytes variant of the container.
Align(Box<[u64]>)
Relocated, aligned binary data, if Bytes doesn’t work for some reason.
Most commonly this works around misaligned binary data, but it can also be useful if the B
type is a scarce resource that should be released.
Implementations§
Source§impl<C: ContainerBytes, B: Deref<Target = [u8]>> Stash<C, B>
impl<C: ContainerBytes, B: Deref<Target = [u8]>> Stash<C, B>
Sourcepub fn borrow<'a>(&'a self) -> <C as Borrow>::Borrowed<'a>
pub fn borrow<'a>(&'a self) -> <C as Borrow>::Borrowed<'a>
Borrows the contents, either from a typed container or by decoding serialized bytes.
This method is relatively cheap but is not free.
Sourcepub fn length_in_bytes(&self) -> usize
pub fn length_in_bytes(&self) -> usize
The number of bytes needed to write the contents using the Indexed encoder.
Sourcepub fn into_bytes<W: Write>(&self, writer: &mut W)
pub fn into_bytes<W: Write>(&self, writer: &mut W)
Write the contents into a std::io::Write using the Indexed encoder.
Trait Implementations§
Source§impl<C: ContainerBytes, B: Deref<Target = [u8]> + Clone + 'static> Borrow for Stash<C, B>
impl<C: ContainerBytes, B: Deref<Target = [u8]> + Clone + 'static> Borrow for Stash<C, B>
Source§type Ref<'a> = <C as Borrow>::Ref<'a>
type Ref<'a> = <C as Borrow>::Ref<'a>
Source§fn borrow<'a>(&'a self) -> Self::Borrowed<'a>
fn borrow<'a>(&'a self) -> Self::Borrowed<'a>
Source§fn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>where
Self: 'a,
fn reborrow<'b, 'a: 'b>(item: Self::Borrowed<'a>) -> Self::Borrowed<'b>where
Self: 'a,
Columnar::reborrow for details.Source§fn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
fn reborrow_ref<'b, 'a: 'b>(item: Self::Ref<'a>) -> Self::Ref<'b>where
Self: 'a,
Columnar::reborrow for details.