pub struct Path {
pub segments: Vec<PathSegment>,
}Expand description
A fully qualified path.
Fields§
§segments: Vec<PathSegment>The path segments.
Implementations§
Source§impl Path
impl Path
Sourcepub fn from_string_with_separator(
string: &str,
separator: impl AsRef<str>,
) -> Self
pub fn from_string_with_separator( string: &str, separator: impl AsRef<str>, ) -> Self
Get Path from a string with a specified separator.
Sourcepub fn to_string_with_separator(&self, separator: impl AsRef<str>) -> String
pub fn to_string_with_separator(&self, separator: impl AsRef<str>) -> String
Convert the Path to a string with a specified separator.
Sourcepub fn first(&self) -> &PathSegment
pub fn first(&self) -> &PathSegment
Get the first segment’s reference.
Sourcepub fn first_mut(&mut self) -> &mut PathSegment
pub fn first_mut(&mut self) -> &mut PathSegment
Get the first segment’s mutable reference.
Sourcepub fn last(&self) -> &PathSegment
pub fn last(&self) -> &PathSegment
Get the last segment’s reference.
Sourcepub fn last_mut(&mut self) -> &mut PathSegment
pub fn last_mut(&mut self) -> &mut PathSegment
Get the last segment’s mutable reference.
Sourcepub fn without_first(self) -> Self
pub fn without_first(self) -> Self
Returns the Path without the first segment.
Sourcepub fn without_last(self) -> Self
pub fn without_last(self) -> Self
Returns the Path without the last segment.
Sourcepub fn pop_front(&mut self) -> Option<PathSegment>
pub fn pop_front(&mut self) -> Option<PathSegment>
Removes the first element and returns it, or None if the Path is empty.
Sourcepub fn pop_back(&mut self) -> Option<PathSegment>
pub fn pop_back(&mut self) -> Option<PathSegment>
Removes the last element and returns it, or None if the Path is empty.
Sourcepub fn push_front(&mut self, segment: impl Into<PathSegment>)
pub fn push_front(&mut self, segment: impl Into<PathSegment>)
Pushes the given segment onto the end of the Path.
Sourcepub fn push_back(&mut self, segment: impl Into<PathSegment>)
pub fn push_back(&mut self, segment: impl Into<PathSegment>)
Pushes the given segment onto the end of the Path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Path
impl<'de> Deserialize<'de> for Path
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Identifier> for Path
impl From<Identifier> for Path
Source§fn from(identifier: Identifier) -> Self
fn from(identifier: Identifier) -> Self
Converts to this type from the input type.
Source§impl From<PathSegment> for Path
impl From<PathSegment> for Path
Source§fn from(segment: PathSegment) -> Self
fn from(segment: PathSegment) -> Self
Converts to this type from the input type.
Source§impl Ord for Path
impl Ord for Path
Source§impl PartialOrd for Path
impl PartialOrd for Path
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> HasBranchesAPI for T
impl<T> HasBranchesAPI for T
Source§fn branches_impl2<T>(self) -> impl Iterator<Item = T>where
Self: Sized + HasBranches<T>,
fn branches_impl2<T>(self) -> impl Iterator<Item = T>where
Self: Sized + HasBranches<T>,
This is used internally. Should use
branches instead.Source§impl<'a, T> HasBranchesAPIV2<'a> for T
impl<'a, T> HasBranchesAPIV2<'a> for T
Source§fn branches<T>(&'a self) -> impl Iterator<Item = T>where
&'a Self: HasBranches<T>,
T: 'a,
fn branches<T>(&'a self) -> impl Iterator<Item = T>where
&'a Self: HasBranches<T>,
T: 'a,
Iterates over the branches of a type.
Source§fn branches_mut<T>(&'a mut self) -> impl Iterator<Item = T>where
&'a mut Self: HasBranches<T>,
T: 'a,
fn branches_mut<T>(&'a mut self) -> impl Iterator<Item = T>where
&'a mut Self: HasBranches<T>,
T: 'a,
Iterates over the branches of a type mutably.
fn all_branches<T>(&'a self) -> impl Iterator<Item = T>
fn all_branches_mut<T>(&'a mut self) -> impl Iterator<Item = T>
Source§impl<T> HasGet for T
impl<T> HasGet for T
Source§impl<'a, T> HasGetAPI<'a> for T
impl<'a, T> HasGetAPI<'a> for T
Source§impl<'a, T> HasRelative<'a> for T
impl<'a, T> HasRelative<'a> for T
Source§fn relative<K>(&'a self, path: impl IntoIterator<Item = K>) -> Option<Self>where
K: Into<String>,
Self: KnowsVisitor<Visitor = Self> + Clone + HasRoot + HasParent + HasPathSegment,
&'a Self: HasBranches<Self>,
fn relative<K>(&'a self, path: impl IntoIterator<Item = K>) -> Option<Self>where
K: Into<String>,
Self: KnowsVisitor<Visitor = Self> + Clone + HasRoot + HasParent + HasPathSegment,
&'a Self: HasBranches<Self>,
Gets a relative path.
“self”, “root”, and “super” are reserved path segments.
“self” is the current object, “root” is the root object, and “super” is the parent object.
Source§impl<'a, T> HasRelativeMut<'a> for T
impl<'a, T> HasRelativeMut<'a> for T
Source§unsafe fn relative_mut<K>(
&'a mut self,
path: impl IntoIterator<Item = K>,
) -> Option<Self>where
K: Into<String>,
Self: Sized + KnowsVisitor<VisitorMut = Self> + UnsafeClone + HasRootMut + HasParentMut + HasPathSegment,
&'a mut Self: HasBranches<Self>,
unsafe fn relative_mut<K>(
&'a mut self,
path: impl IntoIterator<Item = K>,
) -> Option<Self>where
K: Into<String>,
Self: Sized + KnowsVisitor<VisitorMut = Self> + UnsafeClone + HasRootMut + HasParentMut + HasPathSegment,
&'a mut Self: HasBranches<Self>,
Gets a relative path mutably.
“self”, “root”, and “super” are reserved path segments.
“self” is the current object, “root” is the root object, and “super” is the parent object.