Struct kas_wgpu::Toolkit [−][src]
pub struct Toolkit<C: CustomPipe, T: Theme<DrawPipe<C>>> { /* fields omitted */ }
Expand description
A toolkit over winit and WebGPU
All KAS shells are expected to provide a similar Toolkit
type and API.
There is no trait abstraction over this API simply because there is very
little reason to do so (and some reason not to: KISS).
Implementations
Construct a new instance with default options.
Environment variables may affect option selection; see documentation
of Options::from_env
. KAS config is provided by
Options::read_config
.
pub fn new_custom<CB: CustomPipeBuilder<Pipe = C>>(
custom: CB,
theme: T,
options: Options
) -> Result<Self, Error>
pub fn new_custom<CB: CustomPipeBuilder<Pipe = C>>(
custom: CB,
theme: T,
options: Options
) -> Result<Self, Error>
Construct an instance with custom options
The custom
parameter accepts a custom draw pipe (see CustomPipeBuilder
).
Pass ()
if you don’t have one.
The Options
parameter allows direct specification of shell options;
usually, these are provided by Options::from_env
.
KAS config is provided by Options::read_config
and theme
is
configured through Options::init_theme_config
.
pub fn new_custom_config<CB: CustomPipeBuilder<Pipe = C>>(
custom: CB,
theme: T,
options: Options,
config: Rc<RefCell<Config>>
) -> Result<Self, Error>
pub fn new_custom_config<CB: CustomPipeBuilder<Pipe = C>>(
custom: CB,
theme: T,
options: Options,
config: Rc<RefCell<Config>>
) -> Result<Self, Error>
Construct an instance with custom options and config
This is like Toolkit::new_custom
, but allows KAS config to be
specified directly, instead of loading via Options::read_config
.
Unlike other the constructors, this method does not configure the theme.
The user should call Options::init_theme_config
before this method.
Assume ownership of and display a window
This is a convenience wrapper around Toolkit::add_boxed
.
Note: typically, one should have W: Clone
, enabling multiple usage.
Assume ownership of and display a window, inline
This is a convenience wrapper around Toolkit::add_boxed
.
Note: typically, one should have W: Clone
, enabling multiple usage.
Add a boxed window directly
Add a boxed window directly, inline
Create a proxy which can be used to update the UI from another thread
Auto Trait Implementations
impl<C, T> !RefUnwindSafe for Toolkit<C, T>
impl<C, T> Unpin for Toolkit<C, T> where
C: Unpin,
T: Unpin,
<C as CustomPipe>::Window: Unpin,
<T as Theme<DrawPipe<C>>>::Window: Unpin,
impl<C, T> !UnwindSafe for Toolkit<C, T>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more