pub enum Segment {
LongHand(Vec<Selector>),
DotName(String),
Wildcard,
}Expand description
Represents the different forms of SPath segment.
Variants§
LongHand(Vec<Selector>)
Long hand segments contain multiple selectors inside square brackets.
DotName(String)
Dot-name selectors are a short form for representing keys in an object.
Wildcard
The wildcard shorthand .*.
Implementations§
Source§impl Segment
impl Segment
Sourcepub fn is_singular(&self) -> bool
pub fn is_singular(&self) -> bool
Whether this segment extracts at most a singular node.
Sourcepub fn as_long_hand(&self) -> Option<&[Selector]>
pub fn as_long_hand(&self) -> Option<&[Selector]>
Optionally produce self as a slice of selectors, from a long hand segment.
Sourcepub fn as_dot_name(&self) -> Option<&str>
pub fn as_dot_name(&self) -> Option<&str>
Optionally produce self as a single name segment.
Trait Implementations§
Source§impl Queryable for Segment
impl Queryable for Segment
Source§fn query<'b, T: VariantValue, Registry: FunctionRegistry<Value = T>>(
&self,
current: &'b T,
root: &'b T,
registry: &Registry,
) -> Vec<&'b T>
fn query<'b, T: VariantValue, Registry: FunctionRegistry<Value = T>>( &self, current: &'b T, root: &'b T, registry: &Registry, ) -> Vec<&'b T>
Run the query over a
current node with a root node.Source§fn query_located<'b, T: VariantValue, Registry: FunctionRegistry<Value = T>>(
&self,
current: &'b T,
root: &'b T,
registry: &Registry,
parent: NormalizedPath<'b>,
) -> Vec<LocatedNode<'b, T>>
fn query_located<'b, T: VariantValue, Registry: FunctionRegistry<Value = T>>( &self, current: &'b T, root: &'b T, registry: &Registry, parent: NormalizedPath<'b>, ) -> Vec<LocatedNode<'b, T>>
Run the query over a
current node with a root node and a parent path.Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnwindSafe for Segment
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