ValuePath

Trait ValuePath 

Source
pub trait ValuePath<'a>: Clone {
    type Iter: Iterator<Item = BorrowedSegment<'a>> + Clone;

    // Required method
    fn segment_iter(&self) -> Self::Iter;

    // Provided methods
    fn concat<T: ValuePath<'a>>(&self, path: T) -> PathConcat<Self, T> { ... }
    fn eq(&self, other: impl ValuePath<'a>) -> bool { ... }
    fn can_start_with(&self, prefix: impl ValuePath<'a>) -> bool { ... }
    fn to_owned_value_path(&self) -> Result<OwnedValuePath, ()> { ... }
}
Expand description

A path is simply the data describing how to look up a field from a value. This should only be implemented for types that are very cheap to clone, such as references.

Required Associated Types§

Required Methods§

Source

fn segment_iter(&self) -> Self::Iter

Iterates over the raw “Borrowed” segments.

Provided Methods§

Source

fn concat<T: ValuePath<'a>>(&self, path: T) -> PathConcat<Self, T>

Source

fn eq(&self, other: impl ValuePath<'a>) -> bool

Source

fn can_start_with(&self, prefix: impl ValuePath<'a>) -> bool

Source

fn to_owned_value_path(&self) -> Result<OwnedValuePath, ()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> ValuePath<'a> for &'a str

Available on crate features string_path only.
Source§

type Iter = JitValuePathIter<'a>

Source§

fn segment_iter(&self) -> Self::Iter

Source§

impl<'a> ValuePath<'a> for &'a Vec<OwnedSegment>

Source§

type Iter = OwnedSegmentSliceIter<'a>

Source§

fn segment_iter(&self) -> Self::Iter

Source§

impl<'a> ValuePath<'a> for &'a [OwnedSegment]

Source§

type Iter = OwnedSegmentSliceIter<'a>

Source§

fn segment_iter(&self) -> Self::Iter

Source§

impl<'a, 'b> ValuePath<'a> for &'b Vec<BorrowedSegment<'a>>

Implementors§

Source§

impl<'a> ValuePath<'a> for &'a OwnedValuePath

Source§

type Iter = OwnedSegmentSliceIter<'a>

Source§

impl<'a, 'b> ValuePath<'a> for BorrowedValuePath<'a, 'b>

Source§

impl<'a, A: ValuePath<'a>, B: ValuePath<'a>> ValuePath<'a> for PathConcat<A, B>

Source§

type Iter = Chain<<A as ValuePath<'a>>::Iter, <B as ValuePath<'a>>::Iter>