Struct btlib::BlockPath

source ·
pub struct BlockPath(_);
Expand description

An owned identifier for a block in a tree.

Implementations§

source§

impl BlockPath

source

pub const SEP: char = '/'

The character that is used to separate path components. pub const SEP: char = ‘/’;

source

pub const BYTE_LIMIT: usize = 4_096usize

The limit, in bytes, to a path’s length.

source

pub fn new(path: String) -> StdResult<BlockPath, BlockPathError>

Returns a path with the given root and the given components.

source

pub fn from_components<'a, I: Iterator<Item = &'a str>>( root: Principal, components: I ) -> Self

Creates a BlockPath which contains the given root and components.

source

pub fn borrow(&self) -> BlockPathRef<'_>

Returns a reference to this block path.

Methods from Deref<Target = BlockPathGen<String>>§

source

pub fn contains<U: AsRef<str>>(&self, other: &BlockPathGen<U>) -> bool

Returns true if other is a subpath of this path.

source

pub fn root(&self) -> &Principal

Returns a reference to the root of this path.

source

pub fn components(&self) -> Components<'_>

Returns an iterator over the components in this path.

source

pub fn relative_to<'a, U: AsRef<str>>( &'a self, rel_to: &BlockPathGen<U> ) -> Result<RelBlockPath<'a>>

Calculates the RelBlockPath representing this path relative to rel_to.

source

pub fn port(&self) -> Result<u16>

Returns the port to use if this path is used as the bind path of a process.

source

pub fn set_root(&mut self, new_root: Principal)

Sets the new_root as the root of this path.

source

pub fn push_component<T: Display>(&mut self, component: T)

Pushes the given component onto the end of this path. The Display trait is used to write the component at the end of this path.

source

pub fn pop_component(&mut self)

Removes the last component from this path. If there are no components (the path only has the root), then this method leaves the path unchanged.

Trait Implementations§

source§

impl Clone for BlockPath

source§

fn clone(&self) -> BlockPath

Returns a copy 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 Debug for BlockPath

source§

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

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

impl Default for BlockPath

source§

fn default() -> BlockPath

Returns the “default value” for a type. Read more
source§

impl Deref for BlockPath

§

type Target = BlockPathGen<String>

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl DerefMut for BlockPath

source§

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

Mutably dereferences the value.
source§

impl<'de> Deserialize<'de> for BlockPath

source§

fn deserialize<D: Deserializer<'de>>( deserializer: D ) -> StdResult<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for BlockPath

source§

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

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

impl FromStr for BlockPath

§

type Err = BlockPathError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> StdResult<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for BlockPath

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 Ord for BlockPath

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) -> Selfwhere Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

impl PartialEq<BlockPath> for BlockPath

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: AsRef<str>> PartialEq<T> for BlockPath

source§

fn eq(&self, other: &T) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<BlockPath> for BlockPath

source§

fn partial_cmp(&self, other: &Self) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for BlockPath

source§

fn serialize<S: Serializer>(&self, serializer: S) -> StdResult<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> TryFrom<&'a str> for BlockPath

§

type Error = BlockPathError

The type returned in the event of a conversion error.
source§

fn try_from(value: &'a str) -> StdResult<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for BlockPath

§

type Error = BlockPathError

The type returned in the event of a conversion error.
source§

fn try_from(value: String) -> StdResult<Self, Self::Error>

Performs the conversion.
source§

impl Eq for BlockPath

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Free for T

§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,