Struct SubtreePath

Source
pub struct SubtreePath<'b, B> { /* private fields */ }
Expand description

Path to a GroveDB’s subtree with no owned data and cheap to clone.

Implementations§

Source§

impl SubtreePath<'static, [u8; 0]>

Source

pub const fn empty() -> Self

Get empty subtree path (meaning it’ll point to the root tree).

Source§

impl<B> SubtreePath<'_, B>

Source

pub fn len(&self) -> usize

Returns the length of the subtree path.

Source

pub fn is_empty(&self) -> bool

Returns whether the path is empty (the root tree).

Source§

impl<'b, B: AsRef<[u8]>> SubtreePath<'b, B>

Source

pub fn derive_owned(&self) -> SubtreePathBuilder<'b, B>

Get a derived path that will reuse this Self as it’s base path and capable of owning data.

Source

pub fn derive_owned_with_child<'s, S>( &self, segment: S, ) -> SubtreePathBuilder<'b, B>
where S: Into<CowLike<'s>>, 's: 'b,

Get a derived path with a child path segment added.

Source

pub fn derive_parent(&self) -> Option<(SubtreePath<'b, B>, &'b [u8])>

Get a derived subtree path for a parent with care for base path slice case. The main difference from SubtreePath::derive_parent is that lifetime of returned Self if not limited to the scope where this function was called so it’s possible to follow to ancestor paths without keeping previous result as it still will link to 'b (latest SubtreePath or initial slice of data).

Source

pub fn into_reverse_iter(self) -> SubtreePathIter<'b, B>

Get a reverse path segments iterator.

Source

pub fn is_root(&self) -> bool

Retuns true if the subtree path is empty, so it points to the root tree.

Source

pub fn to_vec(&self) -> Vec<Vec<u8>>

Collect path as a vector of vectors, but this actually negates all the benefits of this library.

Trait Implementations§

Source§

impl<B> Clone for SubtreePath<'_, B>

For the same reason as for Hash implementation, derived impl requires generics to carry trait bounds that actually don’t needed.

Source§

fn clone(&self) -> Self

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<'b, B: Debug> Debug for SubtreePath<'b, B>

Source§

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

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

impl<B: AsRef<[u8]>> Display for SubtreePath<'_, B>

Source§

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

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

impl<'b, B> From<&'b [B]> for SubtreePath<'b, B>

Source§

fn from(value: &'b [B]) -> Self

Converts to this type from the input type.
Source§

impl<'b, B, const N: usize> From<&'b [B; N]> for SubtreePath<'b, B>

Source§

fn from(value: &'b [B; N]) -> Self

Converts to this type from the input type.
Source§

impl<'s, 'b, B> From<&'s SubtreePath<'b, B>> for SubtreePathBuilder<'b, B>

Source§

fn from(value: &'s SubtreePath<'b, B>) -> Self

Converts to this type from the input type.
Source§

impl<'s, 'b, B> From<&'s SubtreePathBuilder<'b, B>> for SubtreePath<'s, B>

Create a link to existing SubtreePath that cannot outlive it, because it possibly owns some of the path segments.

Source§

fn from(value: &'s SubtreePathBuilder<'b, B>) -> Self

Converts to this type from the input type.
Source§

impl<B: AsRef<[u8]>> Hash for SubtreePath<'_, B>

Hash order is the same as iteration order: from most deep path segment up to root.

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<BL> Ord for SubtreePath<'_, BL>
where BL: AsRef<[u8]>,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'br, BL, BR> PartialEq<SubtreePath<'br, BR>> for SubtreePath<'_, BL>
where BL: AsRef<[u8]>, BR: AsRef<[u8]>,

Source§

fn eq(&self, other: &SubtreePath<'br, BR>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'br, BL, BR> PartialEq<SubtreePath<'br, BR>> for SubtreePathBuilder<'_, BL>
where BL: AsRef<[u8]>, BR: AsRef<[u8]>,

Source§

fn eq(&self, other: &SubtreePath<'br, BR>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'br, BL, BR> PartialEq<SubtreePathBuilder<'br, BR>> for SubtreePath<'_, BL>
where BL: AsRef<[u8]>, BR: AsRef<[u8]>,

Source§

fn eq(&self, other: &SubtreePathBuilder<'br, BR>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'br, BL, BR> PartialOrd<SubtreePath<'br, BR>> for SubtreePath<'_, BL>
where BL: AsRef<[u8]>, BR: AsRef<[u8]>,

First and foremost, the order of subtree paths is dictated by their lengths. Therefore, those subtrees closer to the root will come first. The rest it can guarantee is to be free of false equality; however, seemingly unrelated subtrees can come one after another if they share the same length, which was (not) done for performance reasons.

Source§

fn partial_cmp(&self, other: &SubtreePath<'br, BR>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'br, BL, BR> PartialOrd<SubtreePathBuilder<'br, BR>> for SubtreePath<'_, BL>
where BL: AsRef<[u8]>, BR: AsRef<[u8]>,

Source§

fn partial_cmp(&self, other: &SubtreePathBuilder<'br, BR>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<B: AsRef<[u8]>> Eq for SubtreePath<'_, B>

Auto Trait Implementations§

§

impl<'b, B> Freeze for SubtreePath<'b, B>

§

impl<'b, B> RefUnwindSafe for SubtreePath<'b, B>
where B: RefUnwindSafe,

§

impl<'b, B> Send for SubtreePath<'b, B>
where B: Sync,

§

impl<'b, B> Sync for SubtreePath<'b, B>
where B: Sync,

§

impl<'b, B> Unpin for SubtreePath<'b, B>

§

impl<'b, B> UnwindSafe for SubtreePath<'b, B>
where B: RefUnwindSafe,

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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.