pub enum Element {
Name(Name),
IndexedField(IndexedField),
}
Expand description
Variants§
Name(Name)
IndexedField(IndexedField)
Implementations§
Source§impl Element
impl Element
Sourcepub fn new_indexed_field<N, I>(name: N, indexes: I) -> Self
pub fn new_indexed_field<N, I>(name: N, indexes: I) -> Self
Creates an element that represents a single attribute name with indexed
field(s) element of a document path. For example, foo[3]
or
foo[7][4]
The indexes
parameter, here, can be an array, slice, Vec
of, or
single usize
.
assert_eq!("foo[3]", Element::new_indexed_field("foo", 3).to_string());
assert_eq!("foo[3]", Element::new_indexed_field("foo", [3]).to_string());
assert_eq!("foo[3]", Element::new_indexed_field("foo", &[3]).to_string());
assert_eq!("foo[3]", Element::new_indexed_field("foo", vec![3]).to_string());
assert_eq!("foo[7][4]", Element::new_indexed_field("foo", [7, 4]).to_string());
assert_eq!("foo[7][4]", Element::new_indexed_field("foo", &[7, 4]).to_string());
assert_eq!("foo[7][4]", Element::new_indexed_field("foo", vec![7, 4]).to_string());
assert_eq!("foo", Element::new_indexed_field("foo", []).to_string());
assert_eq!("foo", Element::new_indexed_field("foo", &[]).to_string());
assert_eq!("foo", Element::new_indexed_field("foo", vec![]).to_string());
See also: IndexedField
, Path
, Path::new_indexed_field
Trait Implementations§
Source§impl From<IndexedField> for Element
impl From<IndexedField> for Element
Source§fn from(value: IndexedField) -> Self
fn from(value: IndexedField) -> Self
Converts to this type from the input type.
Source§impl Ord for Element
impl Ord for Element
Source§impl PartialOrd for Element
impl PartialOrd for Element
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.