pub struct BlockPath(_);
Expand description
An owned identifier for a block in a tree.
Implementations§
source§impl BlockPath
impl BlockPath
sourcepub const SEP: char = '/'
pub const SEP: char = '/'
The character that is used to separate path components. pub const SEP: char = ‘/’;
sourcepub const BYTE_LIMIT: usize = 4_096usize
pub const BYTE_LIMIT: usize = 4_096usize
The limit, in bytes, to a path’s length.
sourcepub fn new(path: String) -> StdResult<BlockPath, BlockPathError>
pub fn new(path: String) -> StdResult<BlockPath, BlockPathError>
Returns a path with the given root and the given components.
sourcepub fn from_components<'a, I: Iterator<Item = &'a str>>(
root: Principal,
components: I
) -> Self
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.
sourcepub fn borrow(&self) -> BlockPathRef<'_>
pub fn borrow(&self) -> BlockPathRef<'_>
Returns a reference to this block path.
Methods from Deref<Target = BlockPathGen<String>>§
sourcepub fn contains<U: AsRef<str>>(&self, other: &BlockPathGen<U>) -> bool
pub fn contains<U: AsRef<str>>(&self, other: &BlockPathGen<U>) -> bool
Returns true if other
is a subpath of this path.
sourcepub fn components(&self) -> Components<'_>
pub fn components(&self) -> Components<'_>
Returns an iterator over the components in this path.
sourcepub fn relative_to<'a, U: AsRef<str>>(
&'a self,
rel_to: &BlockPathGen<U>
) -> Result<RelBlockPath<'a>>
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
.
sourcepub fn port(&self) -> Result<u16>
pub fn port(&self) -> Result<u16>
Returns the port to use if this path is used as the bind path of a process.
sourcepub fn push_component<T: Display>(&mut self, component: T)
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.
sourcepub fn pop_component(&mut self)
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<'de> Deserialize<'de> for BlockPath
impl<'de> Deserialize<'de> for BlockPath
source§fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
fn deserialize<D: Deserializer<'de>>( deserializer: D ) -> StdResult<Self, D::Error>
source§impl Ord for BlockPath
impl Ord for BlockPath
source§impl PartialEq<BlockPath> for BlockPath
impl PartialEq<BlockPath> for BlockPath
source§impl PartialOrd<BlockPath> for BlockPath
impl PartialOrd<BlockPath> for BlockPath
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more