pub enum SourceKey {
Ident(Identifier),
Extension(Identifier),
String(String, StringStyle),
Integer(i64),
Tuple(Vec<SourceKey>),
TupleIndex(u8),
}Expand description
A key in source representation.
This determines how the key should be rendered in the output.
Variants§
Ident(Identifier)
Bare identifier: foo, bar_baz
Extension(Identifier)
Extension namespace: $variant, $eure
String(String, StringStyle)
String key with syntax style hint.
StringStyle::Quoted:"hello world"StringStyle::Literal:'hello world'
Note: PartialEq ignores the style - only content matters for equality.
Integer(i64)
Integer key: 123
Tuple(Vec<SourceKey>)
Tuple key: (1, "a")
TupleIndex(u8)
Tuple index: #0, #1
Implementations§
Source§impl SourceKey
impl SourceKey
Sourcepub fn literal(s: impl Into<String>) -> Self
pub fn literal(s: impl Into<String>) -> Self
Create a literal string key (single-quoted): '...'
Sourcepub fn delimited_lit_str(s: impl Into<String>, level: u8) -> Self
pub fn delimited_lit_str(s: impl Into<String>, level: u8) -> Self
Create a delimited literal string key: <'...'>, <<'...'>>, <<<'...'>>>
Sourcepub fn delimited_code(s: impl Into<String>, level: u8) -> Self
pub fn delimited_code(s: impl Into<String>, level: u8) -> Self
Create a delimited code key: <…>, <<…>>, <<<…>>>
Trait Implementations§
Source§impl From<Identifier> for SourceKey
impl From<Identifier> for SourceKey
Source§fn from(id: Identifier) -> Self
fn from(id: Identifier) -> Self
Converts to this type from the input type.
impl Eq for SourceKey
Auto Trait Implementations§
impl Freeze for SourceKey
impl RefUnwindSafe for SourceKey
impl Send for SourceKey
impl Sync for SourceKey
impl Unpin for SourceKey
impl UnwindSafe for SourceKey
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.