Skip to main content

Cursor

Struct Cursor 

Source
pub struct Cursor<'a, K, A, N, T>
where K: DataTrait + ?Sized, A: DataTrait + ?Sized,
{ /* private fields */ }
Expand description

A cursor for a layer file.

A cursor traverses a RowGroup. It can be positioned on a particular row or before or after the row group. (If the row group is empty, then the cursor can only be before or after the row group.)

Implementations§

Source§

impl<'a, K, A, N, T> Cursor<'a, K, A, N, T>
where K: DataTrait + ?Sized, A: DataTrait + ?Sized, T: ColumnSpec,

Source

pub unsafe fn move_next(&mut self) -> Result<(), Error>

Moves to the next row in the row group. If the cursor was previously before the row group, it moves to the first row; if it was on the last row, it moves after the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn move_prev(&mut self) -> Result<(), Error>

Moves to the previous row in the row group. If the cursor was previously after the row group, it moves to the last row; if it was on the first row, it moves before the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn move_first(&mut self) -> Result<(), Error>

Moves to the first row in the row group. If the row group is empty, this has no effect.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn move_last(&mut self) -> Result<(), Error>

Moves to the last row in the row group. If the row group is empty, this has no effect.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn move_to_row(&mut self, row: u64) -> Result<(), Error>

Moves to row row. If row >= self.len(), moves after the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub fn key(&self) -> Option<&K>

Returns the key in the current row, or None if the cursor is before or after the row group.

Source

pub unsafe fn aux<'b>(&self, aux: &'b mut A) -> Option<&'b mut A>

Returns the auxiliary data in the current row, or None if the cursor is before or after the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn item<'b>( &self, item: (&'b mut K, &'b mut A), ) -> Option<(&'b mut K, &'b mut A)>

Returns the key and auxiliary data in the current row, or None if the cursor is before or after the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn archived_item(&self) -> Option<&dyn ArchivedItem<'_, K, A>>

Returns archived representation of the key and auxiliary data in the current row, or None if the cursor is before or after the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub fn has_value(&self) -> bool

Returns true if the cursor is on a row.

Source

pub fn len(&self) -> u64

Returns the number of rows in the cursor’s row group.

Source

pub fn is_empty(&self) -> bool

Returns true if this cursor’s row group has no rows.

Source

pub fn absolute_position(&self) -> u64

Returns the row number of the current row, as an absolute number relative to the top of the column rather than the top of the row group. If the cursor is before the row group or on the first row, returns the row number of the first row in the row group; if the cursor is after the row group, returns the row number of the row just after the row group.

Source

pub fn remaining_rows(&self) -> u64

Returns the number of times move_next may be called before the cursor is after the row group.

Source

pub unsafe fn seek_forward_until<P>( &mut self, predicate: P, ) -> Result<(), Error>
where P: Fn(&K) -> bool + Clone,

Moves the cursor forward past rows for which predicate returns false, where predicate is a function such that if it is true for a given key, it is also true for all larger keys.

This function does not move the cursor if predicate is true for the current row or a previous row.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn advance_to_value_or_larger( &mut self, target: &K, ) -> Result<(), Error>

Moves the cursor forward past rows whose keys are less than target. This function does not move the cursor if the current row’s key is greater than or equal to target.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn advance_to_first_ge<C>( &mut self, compare: &C, ) -> Result<(), Error>
where C: Fn(&K) -> Ordering,

Moves the cursor forward past rows for which compare returns Less, where compare is a function such that if it returns Equal or Greater for a given key, it returns Greater for all larger keys.

This function does not move the cursor if compare returns Equal or Greater for the current row or a previous row.

§Error handling

If this returns an error, then the cursor’s position might be lost. If so, then its position is advanced past the end of the row group.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn seek_backward_until<P>( &mut self, predicate: P, ) -> Result<(), Error>
where P: Fn(&K) -> bool + Clone,

Moves the cursor backward past rows for which predicate returns false, where predicate is a function such that if it is true for a given key, it is also true for all lesser keys.

This function does not move the cursor if predicate is true for the current row or a previous row.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn rewind_to_value_or_smaller( &mut self, target: &K, ) -> Result<(), Error>
where K: Ord,

Moves the cursor backward past rows whose keys are greater than target. This function does not move the cursor if the current row’s key is less than or equal to target.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source

pub unsafe fn rewind_to_last_le<C>(&mut self, compare: &C) -> Result<(), Error>
where C: Fn(&K) -> Ordering,

Moves the cursor backward past rows for which compare returns Greater, where compare is a function such that if it returns Equal or Less for a given key, it returns Less for all lesser keys.

This function does not move the cursor if compare returns Equal or Less for the current row or a previous row.

§Safety

Unsafe because rkyv deserialization is unsafe.

Source§

impl<'a, K, A, NK, NA, NN, T> Cursor<'a, K, A, (&'static NK, &'static NA, NN), T>
where K: DataTrait + ?Sized, A: DataTrait + ?Sized, NK: DataTrait + ?Sized, NA: DataTrait + ?Sized, T: ColumnSpec,

Source

pub fn next_column<'b>(&'b self) -> Result<RowGroup<'a, NK, NA, NN, T>, Error>

Obtains the row group in the next column associated with the current row. If the cursor is on a row, the returned row group will contain at least one row. If the cursor is before or after the row group, the returned row group will be empty.

This method does not do I/O, but it can report Error::Corruption.

Trait Implementations§

Source§

impl<K, A, N, T> Clone for Cursor<'_, K, A, N, T>
where K: DataTrait + ?Sized, A: DataTrait + ?Sized,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K, A, N, T> Debug for Cursor<'_, K, A, N, T>
where K: DataTrait + ?Sized, A: DataTrait + ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, K, A, N, T> !RefUnwindSafe for Cursor<'a, K, A, N, T>

§

impl<'a, K, A, N, T> !UnwindSafe for Cursor<'a, K, A, N, T>

§

impl<'a, K, A, N, T> Freeze for Cursor<'a, K, A, N, T>
where K: ?Sized, A: ?Sized,

§

impl<'a, K, A, N, T> Send for Cursor<'a, K, A, N, T>
where K: ?Sized, A: ?Sized,

§

impl<'a, K, A, N, T> Sync for Cursor<'a, K, A, N, T>
where K: ?Sized, A: ?Sized,

§

impl<'a, K, A, N, T> Unpin for Cursor<'a, K, A, N, T>
where K: ?Sized, A: ?Sized,

§

impl<'a, K, A, N, T> UnsafeUnpin for Cursor<'a, K, A, N, T>
where K: ?Sized, A: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Data for T
where T: Clone + 'static,

Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more