Struct SubtreePathBuilder

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

Path to a GroveDB’s subtree.

Implementations§

Source§

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

Source

pub fn new() -> Self

Creates empty subtree path

Source§

impl<B> SubtreePathBuilder<'_, B>

Source

pub fn owned_from_iter<S: AsRef<[u8]>>( iter: impl IntoIterator<Item = S>, ) -> Self

Makes an owned SubtreePathBuilder out of iterator.

Source

pub fn owned_from_path<S: AsRef<[u8]>>(path: SubtreePath<'_, S>) -> Self

Create an owned version of SubtreePathBuilder from SubtreePath.

Source§

impl<B> SubtreePathBuilder<'_, 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

pub fn push_segment(&mut self, segment: &[u8])

Adds path segment in place.

Source§

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

Source

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

Get a derived path that will use another subtree path (or reuse the base slice) as it’s base, then could be edited in place.

Source

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

Get a derived path for a parent and a chopped segment. Returned SubtreePath will be linked to this SubtreePath because it might contain owned data and it has to outlive SubtreePath.

Source

pub fn derive_parent_owned( &self, ) -> Option<(SubtreePathBuilder<'b, B>, Vec<u8>)>

Get a derived path for a parent and a chopped segment. The lifetime of returned path is constrained solely by the original slice that this whole path hierarchy is based upon, and the point of derivation has no effect on it.

Source

pub fn derive_owned_with_child<'s, S>( &'b 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 reverse_iter(&'b self) -> SubtreePathIter<'b, B>

Returns an iterator for the subtree path by path segments.

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.

Source

pub fn is_root(&self) -> bool

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

Trait Implementations§

Source§

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

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 SubtreePathBuilder<'b, B>

Source§

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

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

impl Default for SubtreePathBuilder<'static, [u8; 0]>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
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 SubtreePathBuilder<'_, 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 SubtreePathBuilder<'_, 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 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> PartialEq<SubtreePathBuilder<'br, BR>> for SubtreePathBuilder<'_, 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<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<'br, BL, BR> PartialOrd<SubtreePathBuilder<'br, BR>> for SubtreePathBuilder<'_, 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 SubtreePathBuilder<'_, B>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'b, B> UnwindSafe for SubtreePathBuilder<'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, 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.