Struct idx_binary::IdxBinary

source ·
pub struct IdxBinary { /* private fields */ }

Implementations§

source§

impl IdxBinary

source

pub fn new<P: AsRef<Path>>(path: P, allocation_lot: u32) -> Self

Opens the file and creates the IdxBinary.

§Arguments
  • path - Path of file to save data
  • allocation_lot - Extends the specified size when the file size becomes insufficient due to data addition. If you expect to add a lot of data, specifying a larger size will improve performance.
source

pub fn bytes(&self, row: NonZeroU32) -> Option<&[u8]>

Returns the value of the specified row. Returns None if the row does not exist.

source

pub fn update(&mut self, row: NonZeroU32, content: &[u8])

Updates the byte string of the specified row. If row does not exist, it will be expanded automatically..

source

pub fn cmp(&self, data: &DataAddress, content: &[u8]) -> Ordering

Compare the stored data and the byte sequence.

Methods from Deref<Target = Avltriee<T, IdxFileAllocator<T>>>§

pub fn rows_count(&self) -> u32

Return count of rows.

pub fn iter(&self) -> AvltrieeIter<'_, T, A>

Generate an iterator.

pub fn desc_iter(&self) -> AvltrieeIter<'_, T, A>

Generate an iterator. Iterates in descending order.

pub fn iter_by<F, 'a>(&'a self, cmp: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with the same value as the specified value.

pub fn iter_from<F, 'a>(&'a self, search: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator with values ​​starting from the specified value.

pub fn desc_iter_from<F, 'a>(&'a self, search: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator with values ​​starting from the specified value. Iterates in descending order.

pub fn iter_over<F, 'a>(&'a self, search: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​greater than the specified value.

pub fn desc_iter_over<F, 'a>(&'a self, search: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​greater than the specified value. Iterates in descending order.

pub fn iter_to<F, 'a>(&'a self, search_from: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​less than or equal to the specified value.

pub fn desc_iter_to<F, 'a>(&'a self, search_from: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​less than or equal to the specified value. Iterates in descending order.

pub fn iter_under<F, 'a>(&'a self, search_from: F) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​less than the specified value.

pub fn desc_iter_under<F, 'a>( &'a self, search_from: F ) -> AvltrieeIter<'a, T, A>
where F: Fn(&T) -> Ordering,

Generates an iterator of nodes with values ​​less than the specified value. Iterates in descending order.

pub fn iter_range<S, E, 'a>( &'a self, start: S, end: E ) -> AvltrieeIter<'a, T, A>
where S: Fn(&T) -> Ordering, E: Fn(&T) -> Ordering,

Generates an iterator of nodes with the specified range of values.

pub fn desc_iter_range<S, E, 'a>( &'a self, start: S, end: E ) -> AvltrieeIter<'a, T, A>
where S: Fn(&T) -> Ordering, E: Fn(&T) -> Ordering,

Generates an iterator of nodes with the specified range of values. Iterates in descending order.

pub fn delete(&mut self, row: NonZeroU32)

Delete the specified row.

pub fn insert(&mut self, value: T) -> NonZeroU32
where T: Ord + Clone + Default,

Creates a new row and assigns a value to it.

pub fn update(&mut self, row: NonZeroU32, value: T)
where T: Ord + Clone + Default,

Updates the value in the specified row. If you specify a row that does not exist, space will be automatically allocated. If you specify a row that is too large, memory may be allocated unnecessarily.

pub unsafe fn insert_unique_unchecked( &mut self, row: NonZeroU32, value: T, found: Found )
where T: Clone + Default,

Insert a unique value. If you specify a row that does not exist, space will be automatically allocated. If you specify a row that is too large, memory may be allocated unnecessarily.

§Safety

value ​​must be unique.

pub fn get(&self, row: NonZeroU32) -> Option<&AvltrieeNode<T>>

Returns the node of the specified row.

pub unsafe fn get_unchecked(&self, row: NonZeroU32) -> &AvltrieeNode<T>

pub fn search<F>(&self, cmp: F) -> Found
where F: Fn(&T) -> Ordering,

Finds the edge of a node from the specified value.

pub fn is_unique(&self, row: NonZeroU32) -> Option<(bool, &AvltrieeNode<T>)>

Checks whether the specified row is a node with a unique value.

Trait Implementations§

source§

impl AsMut<Avltriee<DataAddress, IdxFileAllocator<DataAddress>>> for IdxBinary

source§

fn as_mut( &mut self ) -> &mut Avltriee<DataAddress, IdxFileAllocator<DataAddress>>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<Avltriee<DataAddress, IdxFileAllocator<DataAddress>>> for IdxBinary

source§

fn as_ref(&self) -> &Avltriee<DataAddress, IdxFileAllocator<DataAddress>>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AvltrieeHolder<DataAddress, &[u8], IdxFileAllocator<DataAddress>> for IdxBinary

source§

fn cmp(&self, left: &DataAddress, right: &&[u8]) -> Ordering

source§

fn search(&self, input: &&[u8]) -> Found

source§

fn convert_value(&mut self, input: &[u8]) -> DataAddress

source§

fn delete_before_update(&mut self, row: NonZeroU32)

source§

impl Deref for IdxBinary

§

type Target = IdxFile<DataAddress>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for IdxBinary

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

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

§

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

§

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.