Skip to main content

ColumnCursor

Trait ColumnCursor 

Source
pub trait ColumnCursor:
    Debug
    + Clone
    + Copy
    + PartialEq
    + Default {
    type Item: Packable + ?Sized;
    type State<'a>: EncoderState<'a, Self::Item>
       where <Self as ColumnCursor>::Item: 'a;
    type PostState<'a>: Debug
       where Self::Item: 'a;
    type Export: Debug + PartialEq + Clone;
    type SlabIndex: Debug + Clone + HasPos + HasAcc + SpanWeight<Slab>;

Show 33 methods // Required methods fn empty() -> Self; fn finalize_state<'a>( slab: &'a Slab, encoder: &mut Encoder<'a, Self>, post: Self::PostState<'a>, cursor: Self, ) -> Option<Self>; fn finish<'a>( slab: &'a Slab, writer: &mut SlabWriter<'a, Self::Item>, cursor: Self, ); fn copy_between<'a>( slab: &'a [u8], writer: &mut SlabWriter<'a, Self::Item>, c0: Self, c1: Self, run: Run<'a, Self::Item>, size: usize, ) -> Self::State<'a>; fn splice_encoder( index: usize, del: usize, slab: &Slab, ) -> SpliceEncoder<'_, Self>; fn slab_size() -> usize; fn try_next<'a>( &mut self, data: &'a [u8], ) -> Result<Option<Run<'a, Self::Item>>, PackError>; fn try_again<'a>( &self, data: &'a [u8], ) -> Result<Option<Run<'a, Self::Item>>, PackError>; fn export_splice<'a, I>( data: &mut Vec<Self::Export>, range: Range<usize>, values: I, ) where I: Iterator<Item = Option<Cow<'a, Self::Item>>>, Self::Item: 'a; fn index(&self) -> usize; fn offset(&self) -> usize; fn load_with<F>( data: &[u8], test: &F, ) -> Result<ColumnData<Self>, PackError> where F: Fn(Option<&Self::Item>) -> Option<String>; // Provided methods fn encode<'a, M, I>(out: &mut Vec<u8>, values: I) -> Range<usize> where M: MaybePackable<'a, Self::Item>, I: IntoIterator<Item = M>, Self::Item: 'a { ... } fn encode_unless_empty<'a, M, I>( out: &mut Vec<u8>, values: I, ) -> Range<usize> where M: MaybePackable<'a, Self::Item>, I: IntoIterator<Item = M>, Self::Item: 'a { ... } fn new(_: &Slab) -> Self { ... } fn iter(slab: &[u8]) -> CursorIter<'_, Self> { ... } fn compute_min_max(_slabs: &mut [Slab]) { ... } fn is_empty(v: Option<Cow<'_, Self::Item>>) -> bool { ... } fn contains_range( &self, run: &Run<'_, Self::Item>, range: &Range<usize>, ) -> Option<Range<usize>> { ... } fn contains( &self, run: &Run<'_, Self::Item>, target: Agg, ) -> Option<Range<usize>> { ... } fn contains_agg( &self, run: &Run<'_, Self::Item>, agg: Agg, ) -> Option<Range<usize>> { ... } fn pop<'a>( &self, run: &mut Run<'a, Self::Item>, ) -> Option<Option<Cow<'a, Self::Item>>> { ... } fn pop_n<'a>( &self, run: &mut Run<'a, Self::Item>, n: usize, ) -> Option<Option<Cow<'a, Self::Item>>> { ... } fn next<'a>(&mut self, data: &'a [u8]) -> Option<Run<'a, Self::Item>> { ... } fn acc(&self) -> Acc { ... } fn min(&self) -> Agg { ... } fn max(&self) -> Agg { ... } fn seek(index: usize, slab: &Slab) -> (Option<Run<'_, Self::Item>>, Self) { ... } fn debug_scan<F>(data: &[u8], test: &F) -> Result<Self, PackError> where F: Fn(Option<&Self::Item>) -> Option<String> { ... } fn load(data: &[u8]) -> Result<ColumnData<Self>, PackError> { ... } fn splice<'a, 'b, I, M>( slab: &'a Slab, index: usize, del: usize, values: I, ) -> SpliceResult where M: MaybePackable<'b, Self::Item>, I: Iterator<Item = M>, Self::Item: 'b { ... } fn splice_delete<'a>( _post: Option<Run<'a, Self::Item>>, _cursor: Self, _del: usize, slab: &'a Slab, ) -> SpliceDel<'a, Self> { ... } fn init_empty(len: usize) -> Slab { ... }
}
Expand description

Core trait for cursor types that know how to decode a specific columnar encoding.

A ColumnCursor is a stateful byte-level decoder for a single slab. It advances through the slab byte-by-byte, yielding Runs of decoded values. The cursor is embedded in RunIter and ultimately drives ColumnDataIter.

You rarely need to implement this trait directly; use one of the built-in cursor type aliases (UIntCursor, StrCursor, etc.) or implement Packable for your type and use RleCursor<B, T>.

§Associated Types

  • Item — the decoded value type (e.g. u64, str)
  • Export — the type returned by to_vec() (often Option<Item::Owned>)
  • SlabIndex — the weight type stored in the B-tree for this cursor
  • State / PostState — encoder state used during splice

Required Associated Types§

Source

type Item: Packable + ?Sized

Source

type State<'a>: EncoderState<'a, Self::Item> where <Self as ColumnCursor>::Item: 'a

Source

type PostState<'a>: Debug where Self::Item: 'a

Source

type Export: Debug + PartialEq + Clone

Source

type SlabIndex: Debug + Clone + HasPos + HasAcc + SpanWeight<Slab>

Required Methods§

Source

fn empty() -> Self

Source

fn finalize_state<'a>( slab: &'a Slab, encoder: &mut Encoder<'a, Self>, post: Self::PostState<'a>, cursor: Self, ) -> Option<Self>

Source

fn finish<'a>( slab: &'a Slab, writer: &mut SlabWriter<'a, Self::Item>, cursor: Self, )

Source

fn copy_between<'a>( slab: &'a [u8], writer: &mut SlabWriter<'a, Self::Item>, c0: Self, c1: Self, run: Run<'a, Self::Item>, size: usize, ) -> Self::State<'a>

Source

fn splice_encoder( index: usize, del: usize, slab: &Slab, ) -> SpliceEncoder<'_, Self>

Source

fn slab_size() -> usize

Source

fn try_next<'a>( &mut self, data: &'a [u8], ) -> Result<Option<Run<'a, Self::Item>>, PackError>

Source

fn try_again<'a>( &self, data: &'a [u8], ) -> Result<Option<Run<'a, Self::Item>>, PackError>

Source

fn export_splice<'a, I>( data: &mut Vec<Self::Export>, range: Range<usize>, values: I, )
where I: Iterator<Item = Option<Cow<'a, Self::Item>>>, Self::Item: 'a,

Source

fn index(&self) -> usize

Source

fn offset(&self) -> usize

Source

fn load_with<F>(data: &[u8], test: &F) -> Result<ColumnData<Self>, PackError>
where F: Fn(Option<&Self::Item>) -> Option<String>,

Provided Methods§

Source

fn encode<'a, M, I>(out: &mut Vec<u8>, values: I) -> Range<usize>
where M: MaybePackable<'a, Self::Item>, I: IntoIterator<Item = M>, Self::Item: 'a,

Source

fn encode_unless_empty<'a, M, I>(out: &mut Vec<u8>, values: I) -> Range<usize>
where M: MaybePackable<'a, Self::Item>, I: IntoIterator<Item = M>, Self::Item: 'a,

Source

fn new(_: &Slab) -> Self

Source

fn iter(slab: &[u8]) -> CursorIter<'_, Self>

Source

fn compute_min_max(_slabs: &mut [Slab])

Source

fn is_empty(v: Option<Cow<'_, Self::Item>>) -> bool

Source

fn contains_range( &self, run: &Run<'_, Self::Item>, range: &Range<usize>, ) -> Option<Range<usize>>

Source

fn contains( &self, run: &Run<'_, Self::Item>, target: Agg, ) -> Option<Range<usize>>

Source

fn contains_agg( &self, run: &Run<'_, Self::Item>, agg: Agg, ) -> Option<Range<usize>>

Source

fn pop<'a>( &self, run: &mut Run<'a, Self::Item>, ) -> Option<Option<Cow<'a, Self::Item>>>

Source

fn pop_n<'a>( &self, run: &mut Run<'a, Self::Item>, n: usize, ) -> Option<Option<Cow<'a, Self::Item>>>

Source

fn next<'a>(&mut self, data: &'a [u8]) -> Option<Run<'a, Self::Item>>

Source

fn acc(&self) -> Acc

Source

fn min(&self) -> Agg

Source

fn max(&self) -> Agg

Source

fn seek(index: usize, slab: &Slab) -> (Option<Run<'_, Self::Item>>, Self)

Source

fn debug_scan<F>(data: &[u8], test: &F) -> Result<Self, PackError>
where F: Fn(Option<&Self::Item>) -> Option<String>,

Source

fn load(data: &[u8]) -> Result<ColumnData<Self>, PackError>

Source

fn splice<'a, 'b, I, M>( slab: &'a Slab, index: usize, del: usize, values: I, ) -> SpliceResult
where M: MaybePackable<'b, Self::Item>, I: Iterator<Item = M>, Self::Item: 'b,

Source

fn splice_delete<'a>( _post: Option<Run<'a, Self::Item>>, _cursor: Self, _del: usize, slab: &'a Slab, ) -> SpliceDel<'a, Self>

Source

fn init_empty(len: usize) -> Slab

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const B: usize, P: Packable + ?Sized, X: HasPos + HasAcc + SpanWeight<Slab>> ColumnCursor for RleCursor<B, P, X>

Source§

type Item = P

Source§

type State<'a> = RleState<'a, P> where P: 'a

Source§

type PostState<'a> = Option<Run<'a, <RleCursor<B, P, X> as ColumnCursor>::Item>> where Self::Item: 'a

Source§

type Export = Option<<P as ToOwned>::Owned>

Source§

type SlabIndex = X