Skip to main content

LayerBuilder

Struct LayerBuilder 

Source
pub struct LayerBuilder<K, L, O = usize>
where K: DataTrait + ?Sized, L: Builder,
{ pub keys: Box<DynVec<K>>, pub offs: Vec<O>, pub vals: L, /* private fields */ }
Expand description

Assembles a layer of this

Fields§

§keys: Box<DynVec<K>>

Keys

§offs: Vec<O>

Offsets

§vals: L

The next layer down

Implementations§

Source§

impl<K, L, O> LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: Builder,

Source

pub fn merge_step( &mut self, (trie1, lower1, upper1): (&Layer<K, L::Trie, O>, &mut usize, usize), (trie2, lower2, upper2): (&Layer<K, L::Trie, O>, &mut usize, usize), map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )
where L: MergeBuilder, O: OrdOffset,

Performs one step of merging.

Source

pub fn merge_step_retain_keys<F>( &mut self, (trie1, lower1, upper1): (&<Self as Builder>::Trie, &mut usize, usize), (trie2, lower2, upper2): (&<Self as Builder>::Trie, &mut usize, usize), filter: &F, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )
where L: MergeBuilder, O: OrdOffset, F: Fn(&K) -> bool,

Source§

impl<K, L, O> LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: MergeBuilder, O: OrdOffset,

Source

pub fn push_merge_fueled( &mut self, (source1, lower1, upper1): (&<Self as Builder>::Trie, &mut usize, usize), (source2, lower2, upper2): (&<Self as Builder>::Trie, &mut usize, usize), map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, fuel: &mut isize, )

Like push_merge, but uses fuel to bound the amount of work.

Builds at most fuel values plus values for one extra key. If fuel > 0 when the method returns, this means that the merge is complete.

Source

pub fn push_merge_retain_keys_fueled<F>( &mut self, (source1, lower1, upper1): (&<Self as Builder>::Trie, &mut usize, usize), (source2, lower2, upper2): (&<Self as Builder>::Trie, &mut usize, usize), filter: &F, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, fuel: &mut isize, )
where F: Fn(&K) -> bool,

Source

pub fn copy_range_fueled( &mut self, other: &<Self as Builder>::Trie, lower: usize, upper: usize, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, fuel: usize, ) -> usize

Like copy_range, but uses fuel to bound the amount of work.

Invariants:

  • Copies at most fuel values plus values for one extra key.
  • If fuel is greater than or equal to the number of values, in the lower..upper key range, copies the entire range.
Source§

impl<K, V, L, O> LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, V: DataTrait + ?Sized, O: OrdOffset, L: MergeBuilder, <L as Builder>::Trie: 'static, for<'a, 'b> <<L as Builder>::Trie as Trie>::Cursor<'a>: Cursor<'a, Key = V>,

Source

pub fn push_merge_retain_values_fueled<KF, VF>( &mut self, (source1, lower1, upper1): (&<Self as Builder>::Trie, &mut usize, usize), (source2, lower2, upper2): (&<Self as Builder>::Trie, &mut usize, usize), key_filter: &KF, value_filter: &VF, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, fuel: &mut isize, )
where KF: Fn(&K) -> bool, VF: Fn(&V) -> bool,

Like push_merge_fueled, but also removes values that don’t pass filter in both inputs.

Trait Implementations§

Source§

impl<K, L, O> Builder for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: Builder, O: OrdOffset,

Source§

type Trie = Layer<K, <L as Builder>::Trie, O>

The type of collection produced.
Source§

fn boundary(&mut self) -> usize

Requests a commitment to the offset of the current-most sub-collection. Read more
Source§

fn done(self) -> Self::Trie

Finalizes the building process and returns the collection.
Source§

impl<K, L, O: Clone> Clone for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized + Clone, L: Builder + Clone, L::Trie: Clone,

Source§

fn clone(&self) -> LayerBuilder<K, L, O>

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, L, O> Debug for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: Builder + Debug, O: 'static + Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<K, L, O> MergeBuilder for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: MergeBuilder, O: OrdOffset,

Source§

fn with_capacity(other1: &Self::Trie, other2: &Self::Trie) -> Self

Allocates an instance of the builder with sufficient capacity to contain the merged data.
Source§

fn reserve(&mut self, additional: usize)

Source§

fn keys(&self) -> usize

The number of keys pushed to the builder so far.
Source§

fn copy_range( &mut self, other: &Self::Trie, lower: usize, upper: usize, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )

Copy a range of other into this collection.
Source§

fn copy_range_retain_keys<'a, F>( &mut self, other: &'a Self::Trie, lower: usize, upper: usize, filter: &F, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )
where F: Fn(&<<Self::Trie as Trie>::Cursor<'a> as Cursor<'a>>::Key) -> bool,

Copy a range of other into this collection, only retaining entries whose keys satisfy the filter condition.
Source§

fn push_merge<'a>( &'a mut self, cursor1: <Self::Trie as Trie>::Cursor<'a>, cursor2: <Self::Trie as Trie>::Cursor<'a>, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )

Merges two sub-collections into one sub-collection. Read more
Source§

fn push_merge_retain_keys<'a, F>( &'a mut self, cursor1: <Self::Trie as Trie>::Cursor<'a>, cursor2: <Self::Trie as Trie>::Cursor<'a>, filter: &F, map_func: Option<&dyn Fn(&mut <<Self as Builder>::Trie as Trie>::LeafKey)>, )
where F: Fn(&<<Self::Trie as Trie>::Cursor<'a> as Cursor<'a>>::Key) -> bool,

Merges two sub-collections into one sub-collection, only retaining entries whose keys satisfy the filter condition.
Source§

impl<K, L, O> SizeOf for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: Builder + SizeOf, Box<DynVec<K>>: SizeOf, Vec<O>: SizeOf,

Source§

fn size_of_children(&self, context: &mut Context)

Gets the size of all “children” owned by this value, not including the size of the value itself. Read more
Source§

fn size_of(&self) -> TotalSize

Gets the total size of the current value
Source§

fn size_of_with_context(&self, context: &mut Context)

Adds the size of the current value to the given Context, including both the size of the value itself and all of its children
Source§

impl<K, L, O> TupleBuilder for LayerBuilder<K, L, O>
where K: DataTrait + ?Sized, L: TupleBuilder, O: OrdOffset,

Source§

fn new(factories: &<Self::Trie as Trie>::Factories) -> Self

Allocates a new builder.
Source§

fn with_capacity( factories: &<Self::Trie as Trie>::Factories, cap: usize, ) -> Self

Allocates a new builder with capacity for at least cap tuples.
Source§

fn reserve_tuples(&mut self, additional: usize)

Reserve space for additional new tuples to be added to the current builder
Source§

fn tuples(&self) -> usize

Source§

fn push_tuple<'a>(&mut self, (key, val): (&mut K, <L::Trie as Trie>::Item<'_>))

Inserts a new tuple into the current builder
Source§

fn push_refs<'a>(&mut self, (key, val): (&K, <L::Trie as Trie>::ItemRef<'_>))

Source§

fn extend_tuples<'a, I>(&'a mut self, tuples: I)
where I: IntoIterator<Item = <Self::Trie as Trie>::Item<'a>>,

Inserts all of the given tuples into the current builder

Auto Trait Implementations§

§

impl<K, L, O = usize> !RefUnwindSafe for LayerBuilder<K, L, O>

§

impl<K, L, O = usize> !UnwindSafe for LayerBuilder<K, L, O>

§

impl<K, L, O> Freeze for LayerBuilder<K, L, O>
where L: Freeze, <<L as Builder>::Trie as Trie>::Factories: Freeze, K: ?Sized,

§

impl<K, L, O> Send for LayerBuilder<K, L, O>
where L: Send, <<L as Builder>::Trie as Trie>::Factories: Send, O: Send, K: ?Sized,

§

impl<K, L, O> Sync for LayerBuilder<K, L, O>
where L: Sync, <<L as Builder>::Trie as Trie>::Factories: Sync, O: Sync, K: ?Sized,

§

impl<K, L, O> Unpin for LayerBuilder<K, L, O>
where L: Unpin, <<L as Builder>::Trie as Trie>::Factories: Unpin, O: Unpin, K: ?Sized,

§

impl<K, L, O> UnsafeUnpin for LayerBuilder<K, L, O>
where L: UnsafeUnpin, <<L as Builder>::Trie as Trie>::Factories: UnsafeUnpin, K: ?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