pub struct ReadWriteFactory { /* private fields */ }
serde
only.Expand description
Read and write config from disk
Implementations§
Source§impl ReadWriteFactory
impl ReadWriteFactory
Sourcepub fn new(path: PathBuf, mode: ConfigMode) -> Self
pub fn new(path: PathBuf, mode: ConfigMode) -> Self
Construct with specified path
and mode
Sourcepub fn fail_on_error(self) -> Self
pub fn fail_on_error(self) -> Self
Fail immediately in case of read error
By default, Config::default
will be returned on read error.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Construct a new instance, reading from environment variables
The following environment variables are read, in case-insensitive mode.
§Config files
WARNING: file formats are not stable and may not be compatible across KAS versions (aside from patch versions)!
The KAS_CONFIG
variable, if given, provides a path to the KAS config
file, which is read or written according to KAS_CONFIG_MODE
.
If KAS_CONFIG
is not specified, platform-default configuration is used
without reading or writing. This may change to use a platform-specific
default path in future versions.
The KAS_CONFIG_MODE
variable determines the read/write mode:
Read
: read-onlyReadWrite
: read on start-up, write on exitWriteDefault
: generate platform-default configuration and write it to the config path(s) specified, overwriting any existing config- If not specified the mode is automatically determined depending on
what
path
resolves to.
If KAS_CONFIG_FAIL_ON_ERROR
is true, config read errors are fatal.
Otherwise default configuration will be used on read error.
Trait Implementations§
Source§impl Clone for ReadWriteFactory
impl Clone for ReadWriteFactory
Source§fn clone(&self) -> ReadWriteFactory
fn clone(&self) -> ReadWriteFactory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl ConfigFactory for ReadWriteFactory
impl ConfigFactory for ReadWriteFactory
Source§impl Debug for ReadWriteFactory
impl Debug for ReadWriteFactory
Source§impl Hash for ReadWriteFactory
impl Hash for ReadWriteFactory
Source§impl PartialEq for ReadWriteFactory
impl PartialEq for ReadWriteFactory
impl Eq for ReadWriteFactory
impl StructuralPartialEq for ReadWriteFactory
Auto Trait Implementations§
impl Freeze for ReadWriteFactory
impl RefUnwindSafe for ReadWriteFactory
impl Send for ReadWriteFactory
impl Sync for ReadWriteFactory
impl Unpin for ReadWriteFactory
impl UnwindSafe for ReadWriteFactory
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<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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