Skip to main content

Trees

Struct Trees 

Source
pub struct Trees<TC, BC = Vec<u64>> {
    pub groups: BC,
    pub bounds: BC,
    pub values: TC,
}
Expand description

A stand-in for Vec<Tree<T>>, with columnar storage for node values.

Nodes are stored in BFS order. groups tracks tree boundaries (cumulative node counts with a leading 0). bounds tracks child ranges per node (also with a leading 0 sentinel).

Fields§

§groups: BC

Cumulative node counts: tree i starts at node groups[i].

§bounds: BC

Child delimiters: node j’s children are at bounds[j]..bounds[j+1] (root nodes use bounds[j]+1..bounds[j+1] to skip themselves).

§values: TC

Columnar container for node values in BFS order.

Implementations§

Source§

impl<TC: Len> Trees<TC>

Source

pub fn push_tree<T>(&mut self, tree: Tree<T>)
where TC: for<'a> Push<&'a T>,

Pushes a tree into the container, storing nodes in BFS order.

Trait Implementations§

Source§

impl<'a, TC: AsBytes<'a>, BC: AsBytes<'a>> AsBytes<'a> for Trees<TC, BC>

Source§

fn as_bytes(&self) -> impl Iterator<Item = (u64, &'a [u8])>

Presents self as a sequence of byte slices, with their required alignment.
Source§

impl<TC: Borrow> Borrow for Trees<TC>

Source§

type Ref<'a> = TreesRef<<TC as Borrow>::Borrowed<'a>, &'a [u64]> where TC: 'a

For each lifetime, a reference with that lifetime. Read more
Source§

type Borrowed<'a> = Trees<<TC as Borrow>::Borrowed<'a>, &'a [u64]> where TC: 'a

The type of a borrowed container. Read more
Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Converts a reference to the type to a borrowed variant. Read more
Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where TC: 'a,

Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Source§

impl<TC: Clear> Clear for Trees<TC>

Source§

fn clear(&mut self)

Clears self, without changing its capacity.
Source§

impl<TC: Clone, BC: Clone> Clone for Trees<TC, BC>

Source§

fn clone(&self) -> Trees<TC, BC>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<TC: Default> Default for Trees<TC>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, TC: FromBytes<'a>, BC: FromBytes<'a>> FromBytes<'a> for Trees<TC, BC>

Source§

const SLICE_COUNT: usize

The number of byte slices this type consumes when reconstructed.
Source§

fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self

Reconstructs self from a sequence of correctly aligned and sized bytes slices. Read more
Source§

fn from_store(store: &DecodedStore<'a>, offset: &mut usize) -> Self

Reconstructs self from a DecodedStore, using direct random access at a given offset. Read more
Source§

fn element_sizes(sizes: &mut Vec<usize>) -> Result<(), String>

Reports the element sizes (in bytes) for each slice this type consumes. Read more
Source§

fn validate(slices: &[(&[u64], u8)]) -> Result<(), String>
where Self: Sized,

Validates that the given slices are compatible with this type. Read more
Source§

impl<'a, TC, BC: IndexAs<u64> + Len> Index for &'a Trees<TC, BC>

Source§

type Ref = TreesRef<&'a TC, &'a BC>

The type returned by the get method. Read more
Source§

fn get(&self, index: usize) -> Self::Ref

Returns the reference type for location index. Read more
Source§

fn last(&self) -> Option<Self::Ref>
where Self: Len,

Source§

fn index_iter(&self) -> IterOwn<&Self>

Converts &self into an iterator. Read more
Source§

fn into_index_iter(self) -> IterOwn<Self>
where Self: Sized,

Converts self into an iterator. Read more
Source§

impl<TC: Index + Copy, BC: IndexAs<u64> + Len + Copy> Index for Trees<TC, BC>

Source§

type Ref = TreesRef<TC, BC>

The type returned by the get method. Read more
Source§

fn get(&self, index: usize) -> Self::Ref

Returns the reference type for location index. Read more
Source§

fn last(&self) -> Option<Self::Ref>
where Self: Len,

Source§

fn index_iter(&self) -> IterOwn<&Self>

Converts &self into an iterator. Read more
Source§

fn into_index_iter(self) -> IterOwn<Self>
where Self: Sized,

Converts self into an iterator. Read more
Source§

impl<TC, BC: Len> Len for Trees<TC, BC>

Source§

fn len(&self) -> usize

The number of contained elements.
Source§

fn is_empty(&self) -> bool

Whether this contains no elements.
Source§

impl<TC: Copy, BC: Copy> Copy for Trees<TC, BC>

Auto Trait Implementations§

§

impl<TC, BC> Freeze for Trees<TC, BC>
where BC: Freeze, TC: Freeze,

§

impl<TC, BC> RefUnwindSafe for Trees<TC, BC>

§

impl<TC, BC> Send for Trees<TC, BC>
where BC: Send, TC: Send,

§

impl<TC, BC> Sync for Trees<TC, BC>
where BC: Sync, TC: Sync,

§

impl<TC, BC> Unpin for Trees<TC, BC>
where BC: Unpin, TC: Unpin,

§

impl<TC, BC> UnsafeUnpin for Trees<TC, BC>
where BC: UnsafeUnpin, TC: UnsafeUnpin,

§

impl<TC, BC> UnwindSafe for Trees<TC, BC>
where BC: UnwindSafe, TC: UnwindSafe,

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> 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> CopyAs<T> for T
where T: Copy,

Source§

fn copy_as(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, S> IndexAs<S> for T
where T: Index, <T as Index>::Ref: CopyAs<S>,

Source§

fn index_as(&self, index: usize) -> S

Source§

fn last(&self) -> Option<T>
where Self: Len,

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> 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.