Struct diskplan_config::Config
source · pub struct Config<'t> { /* private fields */ }
Expand description
Application configuration
Implementations§
source§impl<'t> Config<'t>
impl<'t> Config<'t>
sourcepub fn new(target: impl AsRef<Utf8Path>, apply: bool) -> Self
pub fn new(target: impl AsRef<Utf8Path>, apply: bool) -> Self
Constructs a new application configuration
The target
path defines a directory into which we will begin
The apply
flag controls whether changes should be applied to
the filesystem or just reported
sourcepub fn load(&mut self, path: impl AsRef<Utf8Path>) -> Result<()>
pub fn load(&mut self, path: impl AsRef<Utf8Path>) -> Result<()>
Loads configuation options from the given path
sourcepub fn apply_user_map(&mut self, usermap: HashMap<String, String>)
pub fn apply_user_map(&mut self, usermap: HashMap<String, String>)
Updates this configuration’s user name map with the one provided
sourcepub fn apply_group_map(&mut self, groupmap: HashMap<String, String>)
pub fn apply_group_map(&mut self, groupmap: HashMap<String, String>)
Updates this configuration’s group name map with the one provided
sourcepub fn target_path(&self) -> &Utf8Path
pub fn target_path(&self) -> &Utf8Path
The path intended to be constructed
sourcepub fn will_apply(&self) -> bool
pub fn will_apply(&self) -> bool
Whether to apply the changes to disk
sourcepub fn add_stem(&mut self, root: Root, schema_path: impl AsRef<Utf8Path>)
pub fn add_stem(&mut self, root: Root, schema_path: impl AsRef<Utf8Path>)
Add a root and schema definition file path pair
sourcepub fn add_precached_stem(
&mut self,
root: Root,
schema_path: impl AsRef<Utf8Path>,
schema: SchemaNode<'t>
)
pub fn add_precached_stem( &mut self, root: Root, schema_path: impl AsRef<Utf8Path>, schema: SchemaNode<'t> )
Add a root and schema definition file path pair, adding its already parsed schema to the cache
The file path will not be read; this can be used for testing
sourcepub fn stem_roots(&self) -> impl Iterator<Item = &Root>
pub fn stem_roots(&self) -> impl Iterator<Item = &Root>
Returns an iterator over the configured Root
s
sourcepub fn schema_for<'s, 'p>(
&'s self,
path: &'p Utf8Path
) -> Result<(&SchemaNode<'t>, &Root)>where
's: 't,
pub fn schema_for<'s, 'p>( &'s self, path: &'p Utf8Path ) -> Result<(&SchemaNode<'t>, &Root)>where 's: 't,
Returns the schema for a given path, loaded on demand, or an error if the schema cannot be found, has a syntax error, or otherwise fails to load