BinarySet

Struct BinarySet 

Source
pub struct BinarySet { /* private fields */ }

Implementations§

Source§

impl BinarySet

Source

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

Opens the file and creates the BinarySet. /// # 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 row(&self, content: &[u8]) -> Option<NonZeroU32>

Search for a sequence of bytes.

Source

pub fn row_or_insert(&mut self, content: &[u8]) -> NonZeroU32

Finds a sequence of bytes, inserts it if it doesn’t exist, and returns a row.

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

Source

pub fn rows_count(&self) -> u32

Return count of rows.

Source

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

Generate an iterator.

Source

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

Generate an iterator. Iterates in descending order.

Source

pub fn iter_by<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn iter_from<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn desc_iter_from<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn iter_to<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn desc_iter_to<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn iter_over<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn desc_iter_over<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn iter_under<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

Source

pub fn desc_iter_under<'a>(&'a self, value: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn iter_range<'a>(&'a self, start: &I, end: &I) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn desc_iter_range<'a>( &'a self, start: &I, end: &I, ) -> AvltrieeIter<'a, T, I, A>
where Avltriee<T, I, A>: AvltrieeOrd<T, I, A>,

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

Source

pub fn insert(&mut self, value: &I) -> NonZero<u32>
where T: Clone, Avltriee<T, I, A>: AvltrieeUpdate<T, I, A>,

Creates a new row and assigns a value to it.

Source

pub unsafe fn insert_unique_unchecked( &mut self, row: NonZero<u32>, value: T, found: Found, )

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.

Source

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

Returns the node of the specified row.

Source

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

Source

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

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

Trait Implementations§

Source§

impl AsRef<Avltriee<DataAddress, [u8], IdxFileAllocator<DataAddress>>> for BinarySet

Source§

fn as_ref(&self) -> &IdxFileAvlTriee<DataAddress, [u8]>

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

impl AvltrieeOrd<DataAddress, [u8], IdxFileAllocator<DataAddress>> for BinarySet

Source§

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

Source§

fn search(&self, value: &I) -> Found
where Self: Sized,

Finds the edge of a node from the specified value.
Source§

impl Deref for BinarySet

Source§

type Target = IdxFile<DataAddress, [u8]>

The resulting type after dereferencing.
Source§

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

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.