![]() This was originally added to the Cargo.toml without sufficient review, and it's not currently meaningfully managed by Linebender (e.g. there's no repository or review process for content). Fixes https://github.com/linebender/xilem/issues/990 Further discussion for that issue should move to [#linebender > xilem.dev](https://xi.zulipchat.com/#narrow/channel/419691-linebender/topic/xilem.2Edev/with/520087715). According to [Cargo's docs](https://doc.rust-lang.org/cargo/reference/manifest.html#the-homepage-field), the homepage field should be set to a homepage specifically for the package (which https://linebender.org does not currently fulfil). We should probably have some mention that this is a Linebender crate and link to linebender.org. The exact shape of that is left as follow-up. |
||
---|---|---|
.. | ||
src | ||
web_examples | ||
.gitignore | ||
Cargo.toml | ||
LICENSE | ||
README.md |
README.md
Xilem Web
This is a prototype implementation of the Xilem architecture (through Xilem Core) using DOM elements as Xilem elements (unfortunately the two concepts have the same name).
Quickstart
The easiest way to start, is to use Trunk within some of the examples (see the web_examples/
directory).
Run trunk serve
, then navigate the browser to the link provided (usually http://localhost:8080).
Example
A minimal example to run an application with xilem_web:
use xilem_web::{
document_body,
elements::html::{button, div, p},
interfaces::{Element as _, HtmlDivElement},
App,
};
fn app_logic(clicks: &mut u32) -> impl HtmlDivElement<u32> + use<> {
div((
button(format!("clicked {clicks} times")).on_click(|clicks: &mut u32, _event| *clicks += 1),
(*clicks >= 5).then_some(p("Huzzah, clicked at least 5 times")),
))
}
pub fn main() {
let clicks = 0;
App::new(document_body(), clicks, app_logic).run();
}
Minimum supported Rust Version (MSRV)
This version of Xilem Web has been verified to compile with Rust 1.86 and later.
Future versions of Xilem Web might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases.
Click here if compiling fails.
As time has passed, some of Xilem Web's dependencies could have released versions with a higher Rust requirement. If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency.
# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1
Community
Discussion of Xilem Web development happens in the Linebender Zulip, specifically the #xilem channel. All public content can be read without logging in.
Contributions are welcome by pull request. The Rust code of conduct applies.
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)