pub enum FieldKey<'de> {
Name(Cow<'de, str>),
Full(Box<FullFieldKey<'de>>),
}Expand description
Field key for a serialized field.
This enum is optimized for the common case (simple named keys) while still supporting rich metadata for formats like Styx.
Name: Simple string key (24 bytes) - used by JSON, YAML, TOML, etc.Full: Boxed full key with metadata (8 bytes) - used by Styx for doc/tag support.
Variants§
Name(Cow<'de, str>)
Simple named key (common case for JSON/YAML/TOML).
Full(Box<FullFieldKey<'de>>)
Full key with metadata support (for Styx).
Implementations§
Source§impl<'de> FieldKey<'de>
impl<'de> FieldKey<'de>
Sourcepub fn new(name: impl Into<Cow<'de, str>>, _location: FieldLocationHint) -> Self
pub fn new(name: impl Into<Cow<'de, str>>, _location: FieldLocationHint) -> Self
Create a new field key with a name (common case).
Sourcepub fn with_doc(
name: impl Into<Cow<'de, str>>,
location: FieldLocationHint,
doc: Vec<Cow<'de, str>>,
) -> Self
pub fn with_doc( name: impl Into<Cow<'de, str>>, location: FieldLocationHint, doc: Vec<Cow<'de, str>>, ) -> Self
Create a new field key with a name and documentation.
Sourcepub fn tagged(
tag: impl Into<Cow<'de, str>>,
location: FieldLocationHint,
) -> Self
pub fn tagged( tag: impl Into<Cow<'de, str>>, location: FieldLocationHint, ) -> Self
Create a tagged field key (e.g., @string in Styx).
Used for type pattern keys where the key is a tag rather than a bare identifier.
Sourcepub fn tagged_with_doc(
tag: impl Into<Cow<'de, str>>,
location: FieldLocationHint,
doc: Vec<Cow<'de, str>>,
) -> Self
pub fn tagged_with_doc( tag: impl Into<Cow<'de, str>>, location: FieldLocationHint, doc: Vec<Cow<'de, str>>, ) -> Self
Create a tagged field key with documentation.
Sourcepub fn tagged_with_name(
tag: impl Into<Cow<'de, str>>,
name: impl Into<Cow<'de, str>>,
location: FieldLocationHint,
) -> Self
pub fn tagged_with_name( tag: impl Into<Cow<'de, str>>, name: impl Into<Cow<'de, str>>, location: FieldLocationHint, ) -> Self
Create a tagged field key with a name (e.g., @string"mykey" in Styx).
Used for type pattern keys that also have an associated name/payload.
Sourcepub fn tagged_with_name_and_doc(
tag: impl Into<Cow<'de, str>>,
name: impl Into<Cow<'de, str>>,
location: FieldLocationHint,
doc: Vec<Cow<'de, str>>,
) -> Self
pub fn tagged_with_name_and_doc( tag: impl Into<Cow<'de, str>>, name: impl Into<Cow<'de, str>>, location: FieldLocationHint, doc: Vec<Cow<'de, str>>, ) -> Self
Create a tagged field key with a name and documentation.
Sourcepub fn unit(location: FieldLocationHint) -> Self
pub fn unit(location: FieldLocationHint) -> Self
Create a unit field key (no name).
Used for formats like Styx where @ represents a unit key in maps.
This is equivalent to tagged("") - a tag with an empty name.
Sourcepub fn unit_with_doc(
location: FieldLocationHint,
doc: Vec<Cow<'de, str>>,
) -> Self
pub fn unit_with_doc( location: FieldLocationHint, doc: Vec<Cow<'de, str>>, ) -> Self
Create a unit field key with documentation.
Sourcepub fn location(&self) -> FieldLocationHint
pub fn location(&self) -> FieldLocationHint
Get the location hint.
Trait Implementations§
impl<'de> Eq for FieldKey<'de>
impl<'de> StructuralPartialEq for FieldKey<'de>
Auto Trait Implementations§
impl<'de> Freeze for FieldKey<'de>
impl<'de> RefUnwindSafe for FieldKey<'de>
impl<'de> Send for FieldKey<'de>
impl<'de> Sync for FieldKey<'de>
impl<'de> Unpin for FieldKey<'de>
impl<'de> UnsafeUnpin for FieldKey<'de>
impl<'de> UnwindSafe for FieldKey<'de>
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.