pub struct Options {
pub config_path: PathBuf,
pub theme_config_path: PathBuf,
pub config_mode: ConfigMode,
pub fps_limit: Option<NonZeroU32>,
pub power_preference: PowerPreference,
pub backends: Backends,
pub wgpu_trace_path: Option<PathBuf>,
}
Expand description
Shell options
Fields
config_path: PathBuf
Config file path. Default: empty. See KAS_CONFIG
doc.
theme_config_path: PathBuf
Theme config path. Default: empty.
config_mode: ConfigMode
Config mode. Default: Read.
fps_limit: Option<NonZeroU32>
Maximum frame rate (frames per second)
power_preference: PowerPreference
Adapter power preference. Default value: low power.
backends: Backends
Adapter backend. Default value: PRIMARY (Vulkan/Metal/DX12).
wgpu_trace_path: Option<PathBuf>
WGPU’s API tracing path
Implementations
sourceimpl 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.
Graphics options
The KAS_FPS_LIMIT
variable may be used to limit the number of frames
per second. The default is 60. The value 0
disables this limit.
The KAS_POWER_PREFERENCE
variable supports:
Default
LowPower
HighPerformance
The KAS_BACKENDS
variable supports:
Vulkan
GL
Metal
DX11
DX12
BROWSER_WEBGPU
: web target through webassemblyPRIMARY
: any of Vulkan, Metal or DX12SECONDARY
: any of GL or DX11FALLBACK
: force use of fallback (CPU) rendering
WGPU has an API tracing feature for debugging. To use this, ensure the
wgpu/trace
feature is enabled and set the output path:
export KAS_WGPU_TRACE_PATH="api_trace"
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 theme config on start
sourcepub fn read_config(&self) -> Result<Config, Error>
pub fn read_config(&self) -> Result<Config, Error>
Load/save KAS config on start
Trait Implementations
sourceimpl PartialEq<Options> for Options
impl PartialEq<Options> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Try approximate conversion from Self
to T
Read more
fn cast_approx(self) -> T
fn cast_approx(self) -> T
Cast approximately from Self
to T
Read more
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.