pub struct Options {
pub config_path: PathBuf,
pub theme_config_path: PathBuf,
pub config_mode: ConfigMode,
}Expand description
Application configuration options
Fields§
§config_path: PathBufConfig file path. Default: empty. See KAS_CONFIG doc.
theme_config_path: PathBufTheme config path. Default: empty.
config_mode: ConfigModeConfig mode. Default: Read.
Implementations§
source§impl Options
impl Options
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_THEME_CONFIG variable, if given, provides a path to the theme
config file, which is read or written according to KAS_CONFIG_MODE.
If KAS_THEME_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(default): 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
Note: in the future, the default will likely change to a read-write mode, allowing changes to be written out.
sourcepub fn init_theme_config<DS: DrawSharedImpl, T: Theme<DS>>(
&self,
theme: &mut T
) -> Result<(), Error>
pub fn init_theme_config<DS: DrawSharedImpl, T: Theme<DS>>( &self, theme: &mut T ) -> Result<(), Error>
Load/save and apply theme config on start
Requires feature “serde” to load/save config.
sourcepub fn read_config(&self) -> Result<Config, Error>
pub fn read_config(&self) -> Result<Config, Error>
Load/save KAS config on start
Requires feature “serde” to load/save config.
Trait Implementations§
source§impl PartialEq for Options
impl PartialEq for Options
impl Eq for Options
impl StructuralEq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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
§impl<T> CallHasher for T
impl<T> CallHasher for 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.