Struct DynamicArq

Source
pub struct DynamicArq<T: ArqSpec> { /* private fields */ }
Expand description

A dynamic, and optionally persistent, associative range query data structure.

Implementations§

Source§

impl<T: ArqSpec> DynamicArq<T>

Source

pub fn new(is_persistent: bool) -> Self

Initializes the data structure without creating any nodes.

Source

pub fn build_from_identity(&mut self, size: i64) -> ArqView

Lazily builds a tree initialized to the identity.

Source

pub fn build_from_slice(&mut self, init_val: &[T::S]) -> ArqView

Builds a tree whose leaves are set to a given non-empty slice.

Source

pub fn merge_equal_sized( &mut self, (lp, ls): ArqView, (rp, rs): ArqView, ) -> ArqView

Merges two balanced subtrees into a single tree with a 0-indexed view.

Source

pub fn push(&mut self, (p, s): ArqView) -> (ArqView, ArqView)

Source

pub fn pull(&mut self, p: usize)

Source

pub fn update(&mut self, view: ArqView, l: i64, r: i64, f: &T::F) -> ArqView

Applies the endomorphism f to all entries from l to r, inclusive. If l == r, the updates are eager. Otherwise, they are lazy.

Source

pub fn query(&mut self, view: ArqView, l: i64, r: i64) -> T::S

Returns the aggregate range query on all entries from l to r, inclusive.

Auto Trait Implementations§

§

impl<T> Freeze for DynamicArq<T>

§

impl<T> RefUnwindSafe for DynamicArq<T>
where <T as ArqSpec>::S: RefUnwindSafe, <T as ArqSpec>::F: RefUnwindSafe,

§

impl<T> Send for DynamicArq<T>
where <T as ArqSpec>::S: Send, <T as ArqSpec>::F: Send,

§

impl<T> Sync for DynamicArq<T>
where <T as ArqSpec>::S: Sync, <T as ArqSpec>::F: Sync,

§

impl<T> Unpin for DynamicArq<T>
where <T as ArqSpec>::S: Unpin, <T as ArqSpec>::F: Unpin,

§

impl<T> UnwindSafe for DynamicArq<T>
where <T as ArqSpec>::S: UnwindSafe, <T as ArqSpec>::F: 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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