Crate iced_web[−][src]
A web runtime for Iced, targetting the DOM.
iced_web
takes iced_core
and builds a WebAssembly runtime on top. It
achieves this by introducing a Widget
trait that can be used to produce
VDOM nodes.
The crate is currently a very experimental, simple abstraction layer
over dodrio
.
Usage
The current build process is a bit involved, as wasm-pack
does not
currently support building binary crates.
Therefore, we instead build using the wasm32-unknown-unknown
target and
use the wasm-bindgen
CLI to generate appropriate bindings.
For instance, let’s say we want to build the tour
example:
cd examples
cargo build --package tour --target wasm32-unknown-unknown
wasm-bindgen ../target/wasm32-unknown-unknown/debug/tour.wasm --out-dir tour --web
Then, we need to create an .html
file to load our application:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tour - Iced</title>
</head>
<body>
<script type="module">
import init from "./tour/tour.js";
init('./tour/tour_bg.wasm');
</script>
</body>
</html>
Finally, we serve it using an HTTP server and access it with our browser.
Re-exports
pub use css::Css; |
pub use dodrio; |
pub use iced_futures::futures; |
pub use subscription::Subscription; |
pub use widget::*; |
pub use executor::Executor; |
Modules
css | Style your widgets. |
executor | Choose your preferred executor to power a runtime. |
keyboard | Reuse basic keyboard types. |
mouse | Reuse basic mouse types. |
subscription | Listen to external events in your application. |
widget | Use the built-in widgets or create your own. |
Structs
Bus | A publisher of messages. |
Clipboard | A buffer for short-term storage and transfer within and between applications. |
Color | A color in the sRGB color space. |
Command | A collection of async operations. |
Element | A generic |
Hasher | The hasher used to compare subscriptions. |
Point | A 2D point. |
Rectangle | A rectangle. |
Size | An amount of space in 2 dimensions. |
Vector | A 2D vector. |
Enums
Align | Alignment on an axis of a container. |
Background | The background of some element. |
Font | A font. |
HorizontalAlignment | The horizontal alignment of some resource. |
Length | The strategy used to fill space in a specific dimension. |
VerticalAlignment | The vertical alignment of some resource. |
Traits
Application | An interactive web application. |