Skip to main content

TakConfigLayer

Struct TakConfigLayer 

Source
pub struct TakConfigLayer { /* private fields */ }
Expand description

tak.toml as a settings layer.

Not usage’s FileLayer: tak.toml is tak’s general config file, so most of what it holds — [bench] above all — is not a setting, and scanning the file would warn about every one of those keys. This reads the other way around: it iterates the registry’s source("config", ...) bindings and looks each dotted key up in the parsed TOML, so a key nothing declares is simply not looked at.

A missing tak.toml is fine. A syntax-broken one — or a declared key holding the wrong type — is an error rather than a warning: the file may carry [env] settings that change what gets scrubbed from a subject’s environment, and quietly applying a weaker filter than the project asked for is not a good failure.

Implementations§

Source§

impl TakConfigLayer

Source

pub fn find(start: &Path) -> Result<Self>

Find and parse tak.toml, searching upward from start.

Walking up means settings resolve the same from a subdirectory as from the repository root, exactly like Config::find.

Source

pub fn empty() -> Self

No file at all — what a missing tak.toml resolves with, and what doctor falls back to when the file cannot be read.

Trait Implementations§

Source§

impl Layer for TakConfigLayer

Source§

fn source(&self) -> SourceKind

Which kind of place this reads. Used by the scope check and reported by explain.
Source§

fn load(&self, ctx: &LayerCtx) -> Result<LayerOutput, LayerError>

Everything this layer has to say, in one pass.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.