pub enum LabelForm {
Canonical,
Stripped,
Shortcut,
Community,
}Expand description
How the user spelled a label site, relative to the resolved canonical.
Forward-looking infrastructure for the label namespace model
described in comms/specs/general.lex §4. The eventual contract:
Lex accepts up to three spellings of any lex.* label and one
spelling of any community label, and round-trips the user’s choice
so lexd format does not silently rewrite the source.
Status in this PR (#584 PR 1/5): the enum and the form field
on Label exist; the parse-time NormalizeLabels stage tags
labels that match its legacy-rewrite table, defaulting to
Canonical for every other site. No formatter consults form yet
— lexd format still emits label.value verbatim. PR 2 expands
NormalizeLabels into the full resolution rules (universal
prefix-strip, Community classification, hard-error for doc.*
and unrecognized bare); PR 3 wires form through the formatter
so the roundtrip promise lands end-to-end.
Variants§
Canonical
User wrote the canonical form verbatim (lex.metadata.author).
This is also the default when a Label is constructed
programmatically without a specific source form (e.g. from the
wire codec, where the wire always carries the canonical).
Stripped
User wrote the prefix-stripped form (metadata.author).
Resolves to canonical by prepending lex..
Shortcut
User wrote the one-segment shortcut (author). Resolves to
canonical via the normative shortcut table.
Community
User wrote a community label (acme.task). Carries a single
accepted spelling and round-trips unchanged. Registry validation
is deferred to the analysis stage.
Trait Implementations§
impl Copy for LabelForm
impl Eq for LabelForm
impl StructuralPartialEq for LabelForm
Auto Trait Implementations§
impl Freeze for LabelForm
impl RefUnwindSafe for LabelForm
impl Send for LabelForm
impl Sync for LabelForm
impl Unpin for LabelForm
impl UnsafeUnpin for LabelForm
impl UnwindSafe for LabelForm
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§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.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>
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>
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 more