Expand description
Turns code written in the RavenRS playground into a Cargo project that runs on the desktop
with cargo run and in the browser, as files or as one .zip.
The code is kept as it was written. The project adds what a program needs around it: the
crates it uses, at the version this crate was published with, a main that opens a window,
the browser’s entry point and its page.
use ravenrs_project::Project;
let project = Project::new("Hello world")
.source("use ravenrs::prelude::*;\n\nfn hello() -> impl View {\n Text::new(\"Hello\")\n}\n");
assert_eq!(project.crate_name(), "hello-world");
let lib = project.files()?.into_iter().find(|file| file.path == "src/lib.rs").unwrap();
assert!(lib.contents.contains("pub fn app() -> impl ravenrs::widgets::View {\n hello()\n}"));Structs§
- Dependency
- A RavenRS crate a project uses, with the features it turns on.
- Project
- A Cargo project made from code of the playground.
- Project
File - One file of a project.
Constants§
- RAVENRS_
VERSION - The version of the RavenRS crates a project depends on: the one this crate was published with.
- WASM_
BINDGEN_ VERSION - The
wasm-bindgenthe RavenRS crates were built with. The command line that makes the web build has to be this same version, so it is pinned.