Struct btlib::BlockPathGen

source ·
pub struct BlockPathGen<T> { /* private fields */ }
Expand description

A generic block path.

This type serves to unify the functionality of BlockPath and BlockPathRef.

Implementations§

source§

impl<T: AsRef<str>> BlockPathGen<T>

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§

impl BlockPathGen<String>

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<T: Clone> Clone for BlockPathGen<T>

source§

fn clone(&self) -> BlockPathGen<T>

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<T: Debug> Debug for BlockPathGen<T>

source§

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

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

impl<T: Default> Default for BlockPathGen<T>

source§

fn default() -> BlockPathGen<T>

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

impl<'de> Deserialize<'de> for BlockPathGen<&'de str>

source§

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

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

impl<'de> Deserialize<'de> for BlockPathGen<String>

source§

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

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

impl<T: AsRef<str>> Display for BlockPathGen<T>

source§

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

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

impl<T: AsRef<str>> Hash for BlockPathGen<T>

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<T: AsRef<str>> Ord for BlockPathGen<T>

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<T: AsRef<str>> PartialEq<BlockPathGen<T>> for BlockPathGen<T>

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>, U: AsRef<str>> PartialEq<U> for BlockPathGen<T>

source§

fn eq(&self, other: &U) -> 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>> PartialOrd<BlockPathGen<T>> for BlockPathGen<T>

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<T: AsRef<str>> Serialize for BlockPathGen<T>

source§

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

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

impl<'s> TryFrom<&'s str> for BlockPathGen<&'s str>

§

type Error = BlockPathError

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

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

Performs the conversion.
source§

impl TryFrom<String> for BlockPathGen<String>

§

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<T: AsRef<str>> Eq for BlockPathGen<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for BlockPathGen<T>where T: RefUnwindSafe,

§

impl<T> Send for BlockPathGen<T>where T: Send,

§

impl<T> Sync for BlockPathGen<T>where T: Sync,

§

impl<T> Unpin for BlockPathGen<T>where T: Unpin,

§

impl<T> UnwindSafe for BlockPathGen<T>where T: UnwindSafe,

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