pub enum ValueKind {
Bool,
Unsigned,
Float,
Tz,
Url,
Path,
Text,
LogDirective,
OneOf(&'static [&'static str]),
}Expand description
Domain a setting value must belong to.
Deliberately coarse. The point is to reject what can never work, not to
re-derive every consumer’s parsing: a u64 reader still clamps its own
range, and this only guarantees it receives digits at all.
Variants§
Bool
A boolean in any spelling the readers accept.
Deliberately wider than true|false. The readers are not uniform —
tracing_init.rs takes 1|true|yes|on, lib.rs the same four,
retry.rs only three — and the --low-memory help has always
advertised config set ingest.low_memory 1. Validating against the
narrowest spelling would reject a value the product documents and every
reader honours, which is a regression dressed as a check.
The job here is to reject what NO reader accepts (talvez, maybe),
not to impose a house style on values that already work.
Unsigned
A non-negative integer.
Float
A finite decimal number.
Tz
An IANA timezone name, e.g. America/Sao_Paulo.
Url
An absolute http/https URL.
Path
A filesystem path. Only emptiness is rejected: existence is the caller’s business, and a path that does not exist yet is legitimate.
Text
Free text with no checkable domain.
LogDirective
A tracing filter directive, e.g. warn or sqlite_graphrag=debug.
Not a closed set: the grammar accepts per-target directives, so listing
the five level names would reject legitimate values. Validated by
parsing with the same type tracing_init builds, because
EnvFilter::new DISCARDS an unparseable directive instead of failing —
which is how log.level NIVEL_X used to silence logging outright while
config set reported success.
OneOf(&'static [&'static str])
One of a closed set of spellings.
Implementations§
Source§impl ValueKind
impl ValueKind
Sourcepub fn expectation(&self) -> Option<String>
pub fn expectation(&self) -> Option<String>
Returns a LOCALIZED description of the accepted domain, for the error message.
Returns None when every string is acceptable, which is the signal to
skip validation entirely rather than to accept with an empty reason.
Localized rather than hard-coded English because the message that carries it is translated, and half-translating a sentence is worse than not translating it: the operator reads Portuguese prose that ends in an English clause.
A closed set is NOT translated — those are literal spellings the
operator must type, so true|false is the same string in every locale.
Trait Implementations§
impl Copy for ValueKind
impl Eq for ValueKind
impl StructuralPartialEq for ValueKind
Auto Trait Implementations§
impl Freeze for ValueKind
impl RefUnwindSafe for ValueKind
impl Send for ValueKind
impl Sync for ValueKind
impl Unpin for ValueKind
impl UnsafeUnpin for ValueKind
impl UnwindSafe for ValueKind
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§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.impl<T> ErasedDestructor for Twhere
T: 'static,
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