Skip to main content

SpecConfigProp

Struct SpecConfigProp 

Source
#[non_exhaustive]
pub struct SpecConfigProp {
Show 28 fields pub optional: Option<bool>, pub aliases: Vec<String>, pub default: Option<SpecConfigValue>, pub default_note: Option<String>, pub data_type: SpecDataTypes, pub value_type: Option<SpecConfigType>, pub env: Option<String>, pub envs: Vec<String>, pub deprecated_envs: Vec<String>, pub cli: Vec<String>, pub bindings: BTreeMap<String, Vec<String>>, pub help: Option<String>, pub long_help: Option<String>, pub help_heading: Option<String>, pub choices: Vec<SpecConfigChoice>, pub merge: SpecConfigMerge, pub scope: SpecConfigScope, pub deprecated: Option<String>, pub deprecated_warn_at: Option<String>, pub deprecated_remove_at: Option<String>, pub renamed_to: Option<String>, pub hide: bool, pub since: Option<String>, pub parse: Option<String>, pub writes_to: Option<String>, pub examples: Vec<String>, pub default_list: Vec<SpecConfigValue>, pub extensions: Vec<(String, SpecConfigValue)>,
}

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§optional: Option<bool>

Whether absence is a legitimate resolved value.

None keeps the inferred rule: an option<T> or a property without a default is optional. An explicit value lets a registry state the contract instead of relying on that inference.

§aliases: Vec<String>

Equivalent config keys accepted without a deprecation warning.

§default: Option<SpecConfigValue>§default_note: Option<String>§data_type: SpecDataTypes

The old five-value type, kept so a spec written against it still means what it said.

type is the one to write now; this is set from it where the two overlap, so a consumer reading either sees the same thing.

§value_type: Option<SpecConfigType>

The type, in the expression grammar: list<string>, option<path>, bool|string.

§env: Option<String>

The first environment variable, kept for the specs that wrote env=.

§envs: Vec<String>

Every environment variable that sets this, highest precedence first.

§deprecated_envs: Vec<String>

Environment aliases still read after current names, with a deprecation warning.

§cli: Vec<String>

Flags that set this, as declared elsewhere in the spec.

§bindings: BTreeMap<String, Vec<String>>

Keys this setting has in a custom source kind, by kind name.

§help: Option<String>§long_help: Option<String>§help_heading: Option<String>

The section to list this under in generated docs.

§choices: Vec<SpecConfigChoice>§merge: SpecConfigMerge§scope: SpecConfigScope§deprecated: Option<String>§deprecated_warn_at: Option<String>§deprecated_remove_at: Option<String>§renamed_to: Option<String>

The property that replaces this one, so a value arriving under the old name can be folded into the new one rather than ignored.

§hide: bool

Keep it out of docs and completions.

§since: Option<String>

The version that introduced it.

§parse: Option<String>

A named parser for turning one string into this type — list_by_comma and friends. Vocabulary rather than code, so any implementation can honor it.

§writes_to: Option<String>

Where config set should write this, when it is not the usual file.

§examples: Vec<String>§default_list: Vec<SpecConfigValue>

A list-valued default, which cannot be written as a single property.

Typed like the scalar default, so default 1 2 3 for a list<int> stays three numbers all the way to the JSON schema instead of becoming three strings.

§extensions: Vec<(String, SpecConfigValue)>

Anything a tool needs to carry that usage does not interpret.

Preserved in order and written back out, so a registry with tool-private metadata (mise.rust_type, aube.npm_shared) round-trips through the spec untouched.

Implementations§

Source§

impl SpecConfigProp

Source

pub fn new() -> Self

A config property. Every field is optional; set what applies.

Source

pub fn env(self, env: impl Into<String>) -> Self

An environment variable that sets this property.

Call it more than once for aliases, highest precedence first, the way env "HK_JOBS" "HK_JOB" reads in a spec. Both env and envs are maintained, so a consumer can read either — the parser holds the same invariant, and a builder that left envs empty meant a programmatically built spec serialized without the variable every reader of envs looks for.

Source

pub fn deprecated_env(self, env: impl Into<String>) -> Self

A deprecated environment alias, read after every current name.

Source

pub fn help(self, help: impl Into<String>) -> Self

Short help text.

Source

pub fn default_value(self, default: impl Into<SpecConfigValue>) -> Self

Default value, rendered in docs.

Trait Implementations§

Source§

impl Clone for SpecConfigProp

Source§

fn clone(&self) -> SpecConfigProp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpecConfigProp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SpecConfigProp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SpecConfigProp

Source§

fn eq(&self, other: &SpecConfigProp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SpecConfigProp

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SpecConfigProp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.