pub enum KeySegment {
Key(String),
Index(usize),
Attribute(String),
}Expand description
A segment of a configuration key path.
Key segments represent individual components of a key path:
Key: A named field (e.g.,.database.url)Index: An array index (e.g.,.items[0])Attribute: An attribute name (e.g.,@type)
Variants§
Key(String)
A named key segment.
Index(usize)
An array index segment.
Attribute(String)
An attribute name segment.
Implementations§
Source§impl KeySegment
impl KeySegment
Sourcepub const fn as_index(&self) -> Option<usize>
pub const fn as_index(&self) -> Option<usize>
Returns the index value if this is an index segment.
Sourcepub fn as_attribute(&self) -> Option<&str>
pub fn as_attribute(&self) -> Option<&str>
Returns the attribute name if this is an attribute segment.
Sourcepub fn into_key(self) -> Option<String>
pub fn into_key(self) -> Option<String>
Consumes this segment and returns the key value if it was a key segment.
Sourcepub fn into_index(self) -> Option<usize>
pub fn into_index(self) -> Option<usize>
Consumes this segment and returns the index value if it was an index segment.
Sourcepub fn into_attribute(self) -> Option<String>
pub fn into_attribute(self) -> Option<String>
Consumes this segment and returns the attribute name if it was an attribute segment.
Trait Implementations§
Source§impl Clone for KeySegment
impl Clone for KeySegment
Source§fn clone(&self) -> KeySegment
fn clone(&self) -> KeySegment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeySegment
impl Debug for KeySegment
Source§impl From<&str> for KeySegment
impl From<&str> for KeySegment
Source§impl From<String> for KeySegment
impl From<String> for KeySegment
Source§impl From<usize> for KeySegment
impl From<usize> for KeySegment
Source§impl Hash for KeySegment
impl Hash for KeySegment
Source§impl PartialEq for KeySegment
impl PartialEq for KeySegment
impl Eq for KeySegment
impl StructuralPartialEq for KeySegment
Auto Trait Implementations§
impl Freeze for KeySegment
impl RefUnwindSafe for KeySegment
impl Send for KeySegment
impl Sync for KeySegment
impl Unpin for KeySegment
impl UnsafeUnpin for KeySegment
impl UnwindSafe for KeySegment
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> 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.