Config

Struct 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> !Freeze for Config<'t>

§

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 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> Instrument for T

Source§

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

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

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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