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>
impl<T: AsRef<str>> BlockPathGen<T>
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
.
source§impl BlockPathGen<String>
impl BlockPathGen<String>
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<T: Clone> Clone for BlockPathGen<T>
impl<T: Clone> Clone for BlockPathGen<T>
source§fn clone(&self) -> BlockPathGen<T>
fn clone(&self) -> BlockPathGen<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for BlockPathGen<T>
impl<T: Debug> Debug for BlockPathGen<T>
source§impl<T: Default> Default for BlockPathGen<T>
impl<T: Default> Default for BlockPathGen<T>
source§fn default() -> BlockPathGen<T>
fn default() -> BlockPathGen<T>
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for BlockPathGen<&'de str>
impl<'de> Deserialize<'de> for BlockPathGen<&'de str>
source§fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
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>
impl<'de> Deserialize<'de> for BlockPathGen<String>
source§fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
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>> Ord for BlockPathGen<T>
impl<T: AsRef<str>> Ord for BlockPathGen<T>
source§impl<T: AsRef<str>> PartialEq<BlockPathGen<T>> for BlockPathGen<T>
impl<T: AsRef<str>> PartialEq<BlockPathGen<T>> for BlockPathGen<T>
source§impl<T: AsRef<str>> PartialOrd<BlockPathGen<T>> for BlockPathGen<T>
impl<T: AsRef<str>> PartialOrd<BlockPathGen<T>> for BlockPathGen<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl<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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more