pub struct ConfigSchema {
pub version: u32,
pub sections: BTreeMap<String, SectionSchema>,
}Fields§
§version: u32§sections: BTreeMap<String, SectionSchema>Implementations§
Source§impl ConfigSchema
impl ConfigSchema
pub fn generate() -> ConfigSchema
Sourcepub fn lookup(&self, key: &str) -> Option<&KeySchema>
pub fn lookup(&self, key: &str) -> Option<&KeySchema>
Looks up a key schema by its dot-separated TOML path.
Returns None if the key is not part of the schema.
Sourcepub fn known_keys(&self) -> Vec<String>
pub fn known_keys(&self) -> Vec<String>
All known TOML keys (dot-separated) for validation.
Combines the hand-written schema (which carries descriptions, types and
help text) with the keys derived from the live Config struct. The
struct is the source of truth for what is valid, so a field added to
Config is recognised by config apply / config validate immediately,
without anyone remembering to mirror it into sections_*.rs (#456).
Source§impl ConfigSchema
impl ConfigSchema
Sourcepub fn undocumented_keys(&self) -> Vec<(String, Value)>
pub fn undocumented_keys(&self) -> Vec<(String, Value)>
Leaf keys Config::default() serialises (so the loader accepts them and
config init --full writes them) that have no schema entry yet, with
their default value. The generated reference lists them so it names
every accepted key even before each one has a description (gh-2283).
Trait Implementations§
Source§impl Clone for ConfigSchema
impl Clone for ConfigSchema
Source§fn clone(&self) -> ConfigSchema
fn clone(&self) -> ConfigSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfigSchema
impl Debug for ConfigSchema
Source§impl Serialize for ConfigSchema
impl Serialize for ConfigSchema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Forget for ConfigSchema
impl Freeze for ConfigSchemawhere
*const LeafNode<String, SectionSchema> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, SectionSchema)>>: Freeze,
impl Move for ConfigSchema
impl RefUnwindSafe for ConfigSchema
impl Send for ConfigSchemawhere
NodeRef<Owned, String, SectionSchema, LeafOrInternal>: Send,
BoxRaw<(String, SectionSchema)>: Send,
impl Sync for ConfigSchemawhere
NodeRef<Owned, String, SectionSchema, LeafOrInternal>: Sync,
BoxRaw<(String, SectionSchema)>: Sync,
impl Unpin for ConfigSchema
impl UnsafeUnpin for ConfigSchemawhere
*const LeafNode<String, SectionSchema> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, SectionSchema)>>: UnsafeUnpin,
impl UnwindSafe for ConfigSchema
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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