Struct dotfiles_core::directive::DirectiveData
source · pub struct DirectiveData { /* private fields */ }
Expand description
A struct that contains the default settings for a Directive and the name it takes in configuration sources. The name must be unique.
These default settings can be configured by the user as well.
Implementations§
source§impl DirectiveData
impl DirectiveData
sourcepub fn name(&self) -> &String
pub fn name(&self) -> &String
Unique name of this directive.
This name will be used in configuration sources to instantiate actions of this directive
sourcepub fn defaults(&self) -> &Settings
pub fn defaults(&self) -> &Settings
Default settings for this directive.
Any setting that is not in the defaults for a directive but is part of the corresponding Action struct is considered to be mandatory.
Since all configurable settings have a default, this can also be used to infer the data types.
source§impl DirectiveData
impl DirectiveData
sourcepub fn from(name: String, defaults: Settings) -> DirectiveData
pub fn from(name: String, defaults: Settings) -> DirectiveData
Constructs a new directive from a name and a set of default settings.
sourcepub fn parse_setting_value(
&self,
name: &str,
yaml: &StrictYaml
) -> Result<Setting, DotfilesError>
pub fn parse_setting_value( &self, name: &str, yaml: &StrictYaml ) -> Result<Setting, DotfilesError>
DirectiveData.setting_types
.
sourcepub fn parse_context_defaults(
&self,
yaml_settings: &StrictYaml
) -> Result<Settings, DotfilesError>
pub fn parse_context_defaults( &self, yaml_settings: &StrictYaml ) -> Result<Settings, DotfilesError>
Parses all settings for this directive from StrictYaml, checking the types correspond to
what’s stored in DirectiveData.setting_types
Trait Implementations§
source§impl Clone for DirectiveData
impl Clone for DirectiveData
source§fn clone(&self) -> DirectiveData
fn clone(&self) -> DirectiveData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for DirectiveData
impl RefUnwindSafe for DirectiveData
impl Send for DirectiveData
impl Sync for DirectiveData
impl Unpin for DirectiveData
impl UnwindSafe for DirectiveData
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> 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