Struct diskplan_config::Config

source ·
pub struct Config<'t> { /* private fields */ }
Expand description

Application configuration

Implementations§

source§

impl<'t> Config<'t>

source

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

source

pub fn load(&mut self, path: impl AsRef<Utf8Path>) -> Result<()>

Loads configuation options from the given path

source

pub fn apply_user_map(&mut self, usermap: HashMap<String, String>)

Updates this configuration’s user name map with the one provided

source

pub fn apply_group_map(&mut self, groupmap: HashMap<String, String>)

Updates this configuration’s group name map with the one provided

source

pub fn target_path(&self) -> &Utf8Path

The path intended to be constructed

source

pub fn will_apply(&self) -> bool

Whether to apply the changes to disk

source

pub fn add_stem(&mut self, root: Root, schema_path: impl AsRef<Utf8Path>)

Add a root and schema definition file path pair

source

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

source

pub fn stem_roots(&self) -> impl Iterator<Item = &Root>

Returns an iterator over the configured Roots

source

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

source

pub fn map_user<'a>(&'a self, name: &'a str) -> &'a str

Applies the user map to the given user name, returning itself if no mapping exists for this name

source

pub fn map_group<'a>(&'a self, name: &'a str) -> &'a str

Applies the group map to the given group name, returning itself if no mapping exists for this name

Auto Trait Implementations§

§

impl<'t> !RefUnwindSafe for Config<'t>

§

impl<'t> Send for Config<'t>

§

impl<'t> !Sync for Config<'t>

§

impl<'t> Unpin for Config<'t>

§

impl<'t> UnwindSafe for Config<'t>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more