pub struct ElementPathBuf { /* private fields */ }Expand description
A path to a particular child Element.
Implementations§
Source§impl ElementPathBuf
impl ElementPathBuf
Sourcepub fn from_path(path: &ElementPath) -> Self
pub fn from_path(path: &ElementPath) -> Self
Create a new selector by copying the given path.
Sourcepub fn as_path(&self) -> &ElementPath
pub fn as_path(&self) -> &ElementPath
Get this ElementPathBuf as an ElementPath slice.
Sourcepub fn as_mut_path(&mut self) -> &mut ElementPath
pub fn as_mut_path(&mut self) -> &mut ElementPath
Get this ElementPathBuf as a mut ElementPath slice.
Sourcepub fn push<S>(&mut self, selector: S)where
S: Into<ElementSelector>,
pub fn push<S>(&mut self, selector: S)where
S: Into<ElementSelector>,
Push the given selector onto the end of this path.
Sourcepub fn append<P>(&mut self, path: P)where
P: ElementIndex,
pub fn append<P>(&mut self, path: P)where
P: ElementIndex,
Append another ElementIndex to the end of this path.
Sourcepub fn pop(&mut self) -> Option<ElementSelector>
pub fn pop(&mut self) -> Option<ElementSelector>
Pop the last element off of this path selector, transforming it into its parent.
Returns the ElementSelector that was popped, or None if the path was already
the root.
Methods from Deref<Target = ElementPath>§
pub const EMPTY: &ElementPath
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Gets the number of selectors in this ElementPath.
Sourcepub fn to_buf(&self) -> ElementPathBuf
pub fn to_buf(&self) -> ElementPathBuf
Creates an ElementPathBuf from this ElementPath.
Sourcepub fn as_slice(&self) -> &[ElementSelector]
pub fn as_slice(&self) -> &[ElementSelector]
Get this ElementPath as a slice.
Sourcepub fn as_mut_slice(&mut self) -> &mut [ElementSelector]
pub fn as_mut_slice(&mut self) -> &mut [ElementSelector]
Get this ElementPath as a mutable slice.
Sourcepub fn iter(&self) -> Iter<'_, ElementSelector>
pub fn iter(&self) -> Iter<'_, ElementSelector>
Get an iterator over the selectors in this path.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, ElementSelector>
pub fn iter_mut(&mut self) -> IterMut<'_, ElementSelector>
Get an iterator over mutable selectors in this path.
Sourcepub fn parent(&self) -> Option<&ElementPath>
pub fn parent(&self) -> Option<&ElementPath>
Get the parent of this ElementPath if any. Returns None for the root (empty)
path.
Sourcepub fn last(&self) -> Option<ElementSelector>
pub fn last(&self) -> Option<ElementSelector>
Gets the last selector from the ElementPath.
Sourcepub fn last_mut(&mut self) -> Option<&mut ElementSelector>
pub fn last_mut(&mut self) -> Option<&mut ElementSelector>
Mutably gets the last selector from the ElementPath.
Trait Implementations§
Source§impl AsMut<[ElementSelector]> for ElementPathBuf
impl AsMut<[ElementSelector]> for ElementPathBuf
Source§fn as_mut(&mut self) -> &mut [ElementSelector]
fn as_mut(&mut self) -> &mut [ElementSelector]
Source§impl AsMut<ElementPath> for ElementPathBuf
impl AsMut<ElementPath> for ElementPathBuf
Source§fn as_mut(&mut self) -> &mut ElementPath
fn as_mut(&mut self) -> &mut ElementPath
Source§impl AsRef<[ElementSelector]> for ElementPathBuf
impl AsRef<[ElementSelector]> for ElementPathBuf
Source§fn as_ref(&self) -> &[ElementSelector]
fn as_ref(&self) -> &[ElementSelector]
Source§impl AsRef<ElementPath> for ElementPathBuf
impl AsRef<ElementPath> for ElementPathBuf
Source§fn as_ref(&self) -> &ElementPath
fn as_ref(&self) -> &ElementPath
Source§impl Borrow<ElementPath> for ElementPathBuf
impl Borrow<ElementPath> for ElementPathBuf
Source§fn borrow(&self) -> &ElementPath
fn borrow(&self) -> &ElementPath
Source§impl BorrowMut<ElementPath> for ElementPathBuf
impl BorrowMut<ElementPath> for ElementPathBuf
Source§fn borrow_mut(&mut self) -> &mut ElementPath
fn borrow_mut(&mut self) -> &mut ElementPath
Source§impl Clone for ElementPathBuf
impl Clone for ElementPathBuf
Source§fn clone(&self) -> ElementPathBuf
fn clone(&self) -> ElementPathBuf
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more