Get cargo check --all working

This commit is contained in:
Jonathan Kelley committed 2024-01-18 19:27:55 -08:00
1 parent d8af9b7ed1
commit 6ed3aafb2f
34 files changed
+80 -122

No files matched your search

Generated
+3 -38
View File
@@ -83,15 +83,6 @@ dependencies = [
"zerocopy", "zerocopy",
] ]
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.2" version = "1.1.2"
@@ -2461,7 +2452,6 @@ dependencies = [
"futures-util", "futures-util",
"global-hotkey", "global-hotkey",
"infer 0.11.0", "infer 0.11.0",
"minify-js",
"muda", "muda",
"objc", "objc",
"objc_id", "objc_id",
@@ -2653,7 +2643,6 @@ dependencies = [
"dioxus-interpreter-js", "dioxus-interpreter-js",
"futures-channel", "futures-channel",
"futures-util", "futures-util",
"minify-js",
"once_cell", "once_cell",
"pretty_env_logger", "pretty_env_logger",
"rocket", "rocket",
@@ -4123,7 +4112,7 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
dependencies = [ dependencies = [
"aho-corasick 1.1.2", "aho-corasick",
"bstr 1.9.0", "bstr 1.9.0",
"log", "log",
"regex-automata 0.4.3", "regex-automata 0.4.3",
@@ -4462,7 +4451,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [ dependencies = [
"ahash 0.8.7", "ahash 0.8.7",
"bumpalo",
] ]
[[package]] [[package]]
@@ -5960,16 +5948,6 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "minify-js"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22d6c512a82abddbbc13b70609cb2beff01be2c7afff534d6e5e1c85e438fc8b"
dependencies = [
"lazy_static",
"parse-js",
]
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
version = "0.2.1" version = "0.2.1"
@@ -6699,19 +6677,6 @@ dependencies = [
"windows-targets 0.48.5", "windows-targets 0.48.5",
] ]
[[package]]
name = "parse-js"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ec3b11d443640ec35165ee8f6f0559f1c6f41878d70330fe9187012b5935f02"
dependencies = [
"aho-corasick 0.7.20",
"bumpalo",
"hashbrown 0.13.2",
"lazy_static",
"memchr",
]
[[package]] [[package]]
name = "password-hash" name = "password-hash"
version = "0.4.2" version = "0.4.2"
@@ -7666,7 +7631,7 @@ version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [ dependencies = [
"aho-corasick 1.1.2", "aho-corasick",
"memchr", "memchr",
"regex-automata 0.4.3", "regex-automata 0.4.3",
"regex-syntax 0.8.2", "regex-syntax 0.8.2",
@@ -7687,7 +7652,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [ dependencies = [
"aho-corasick 1.1.2", "aho-corasick",
"memchr", "memchr",
"regex-syntax 0.8.2", "regex-syntax 0.8.2",
] ]
+1 -1
View File
@@ -5,7 +5,7 @@ fn main() {
wasm_logger::init(wasm_logger::Config::default()); wasm_logger::init(wasm_logger::Config::default());
console_error_panic_hook::set_once(); console_error_panic_hook::set_once();
dioxus_web::launch(app); launch(app);
} }
fn app() -> Element { fn app() -> Element {
+1 -1
View File
@@ -2,7 +2,7 @@
name = "mobile-demo" name = "mobile-demo"
version = "0.1.0" version = "0.1.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"] authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018" edition = "2021"
[lib] [lib]
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
+1 -1
View File
@@ -83,5 +83,5 @@ fn App() -> Element {
} }
fn main() { fn main() {
dioxus_web::launch(App); launch(App);
} }
+1 -1
View File
@@ -88,7 +88,7 @@ interprocess-docfix = { version = "1.2.2" }
gitignore = "1.0.8" gitignore = "1.0.8"
[features] [features]
default = ["plugin"] default = []
plugin = ["mlua"] plugin = ["mlua"]
[[bin]] [[bin]]
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-core" name = "dioxus-core"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences" description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+3 -3
View File
@@ -2,7 +2,7 @@
name = "dioxus-desktop" name = "dioxus-desktop"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "WebView renderer for Dioxus" description = "WebView renderer for Dioxus"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
@@ -83,8 +83,8 @@ dioxus = { workspace = true, features = ["launch", "desktop"]}
exitcode = "1.1.2" exitcode = "1.1.2"
[build-dependencies] [build-dependencies]
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] } # dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
minify-js = "0.5.6" # minify-js = "0.5.6"
# These tests need to be run on the main thread, so they cannot use rust's test harness. # These tests need to be run on the main thread, so they cannot use rust's test harness.
[[test]] [[test]]
File renamed without changes.
+1 -1
View File
@@ -66,7 +66,7 @@ pub fn launch_virtual_dom(virtual_dom: VirtualDom, desktop_config: Config) {
/// Launches the WebView and runs the event loop, with configuration and root props. /// Launches the WebView and runs the event loop, with configuration and root props.
pub fn launch( pub fn launch(
root: fn() -> Element, root: fn() -> Element,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>, contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
platform_config: Config, platform_config: Config,
) { ) {
let mut virtual_dom = VirtualDom::new(root); let mut virtual_dom = VirtualDom::new(root);
+3 -3
View File
@@ -16,10 +16,10 @@ pub struct LaunchBuilder<Cfg = ()> {
pub type LaunchFn<Cfg> = fn(fn() -> Element, ContextList, Cfg); pub type LaunchFn<Cfg> = fn(fn() -> Element, ContextList, Cfg);
#[cfg(feature = "fullstack")] // #[cfg(feature = "fullstack")]
type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>; type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>;
#[cfg(not(feature = "fullstack"))] // #[cfg(not(feature = "fullstack"))]
type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any>>>; // type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any>>>;
impl LaunchBuilder { impl LaunchBuilder {
/// Create a new builder for your application. This will create a launch configuration for the current platform based on the features enabled on the `dioxus` crate. /// Create a new builder for your application. This will create a launch configuration for the current platform based on the features enabled on the `dioxus` crate.
+1 -1
View File
@@ -2,7 +2,7 @@
name = "fermi" name = "fermi"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Global state management for Dioxus" description = "Global state management for Dioxus"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+1
View File
@@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
homepage = "https://dioxuslabs.com" homepage = "https://dioxuslabs.com"
keywords = ["ui", "gui", "react", "ssr", "fullstack"] keywords = ["ui", "gui", "react", "ssr", "fullstack"]
resolver = "2"
[dependencies] [dependencies]
# server functions # server functions
@@ -9,7 +9,7 @@ use dioxus_fullstack::prelude::*;
use dioxus_router::prelude::*; use dioxus_router::prelude::*;
fn main() { fn main() {
let config = LaunchBuilder::<FullstackRouterConfig<Route>>::router(); let config = LaunchBuilder::fullstack();
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
config config
.incremental( .incremental(
@@ -19,7 +19,12 @@ fn main() {
.launch(); .launch();
#[cfg(not(feature = "ssr"))] #[cfg(not(feature = "ssr"))]
config.launch(); config.launch(|| {
rsx! {
Router::<Route> {
}
}
});
} }
#[derive(Clone, Routable, Debug, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Clone, Routable, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
@@ -36,9 +41,9 @@ fn Blog(id: i32) -> Element {
Link { to: Route::Home {}, "Go to counter" } Link { to: Route::Home {}, "Go to counter" }
table { table {
tbody { tbody {
for _ in 0..*id { for _ in 0..id {
tr { tr {
for _ in 0..*id { for _ in 0..id {
td { "hello world!" } td { "hello world!" }
} }
} }
@@ -56,7 +61,7 @@ fn Home() -> Element {
rsx! { rsx! {
Link { Link {
to: Route::Blog { to: Route::Blog {
id: *count.get() id: count()
}, },
"Go to blog" "Go to blog"
} }
@@ -9,34 +9,25 @@ use dioxus::prelude::*;
use dioxus_fullstack::{launch, prelude::*}; use dioxus_fullstack::{launch, prelude::*};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Props, PartialEq, Debug, Default, Serialize, Deserialize, Clone)] fn app() -> Element {
struct AppProps { let state = use_server_future(move || async move { get_server_data().await.unwrap() });
count: i32,
}
fn app(cx: Scope<AppProps>) -> Element {
let state =
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_signal(|| 0); let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string()); let mut text = use_signal(|| "...".to_string());
rsx! { rsx! {
div { div {
"Server state: {state}" "Server state: {state.unwrap().value().clone()}"
} }
h1 { "High-Five counter: {count}" } h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" } button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" } button { onclick: move |_| count -= 1, "Down low!" }
button { button {
onclick: move |_| { onclick: move |_| async move {
to_owned![text]; if let Ok(data) = get_server_data().await {
async move { println!("Client received: {}", data);
if let Ok(data) = get_server_data().await { text.set(data.clone());
println!("Client received: {}", data); post_server_data(data).await.unwrap();
text.set(data.clone());
post_server_data(data).await.unwrap();
}
} }
}, },
"Run a server function!" "Run a server function!"
@@ -63,5 +54,5 @@ fn main() {
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
tracing_subscriber::fmt::init(); tracing_subscriber::fmt::init();
LaunchBuilder::new_with_props(app, AppProps { count: 0 }).launch() LaunchBuilder::fullstack().launch(app);
} }
+2 -2
View File
@@ -66,8 +66,8 @@ pub mod prelude {
} }
// Warn users about overlapping features // Warn users about overlapping features
#[cfg(all(feature = "ssr", feature = "web"))] #[cfg(all(feature = "ssr", feature = "web", not(doc)))]
compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `web` feature are overlapping. Please choose one or the other."); compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `web` feature are overlapping. Please choose one or the other.");
#[cfg(all(feature = "ssr", feature = "desktop"))] #[cfg(all(feature = "ssr", feature = "desktop", not(doc)))]
compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `desktop` feature are overlapping. Please choose one or the other."); compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `desktop` feature are overlapping. Please choose one or the other.");
+1 -1
View File
@@ -2,7 +2,7 @@
name = "generational-box" name = "generational-box"
authors = ["Evan Almloff"] authors = ["Evan Almloff"]
version = "0.4.3" version = "0.4.3"
edition = "2018" edition = "2021"
description = "A box backed by a generational runtime" description = "A box backed by a generational runtime"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-hooks" name = "dioxus-hooks"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Basic useful hooks for Dioxus." description = "Basic useful hooks for Dioxus."
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-html" name = "dioxus-html"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "HTML Element pack for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences" description = "HTML Element pack for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+2 -2
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "dioxus-interpreter-js" name = "dioxus-interpreter-js"
version = { workspace = true } version = { workspace = true }
edition = "2018" edition = "2021"
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
description = "JS Intepreter for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences" description = "JS Intepreter for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@@ -28,7 +28,7 @@ dioxus-html = { workspace = true, optional = true }
default = [] default = []
serialize = ["serde"] serialize = ["serde"]
sledgehammer = ["sledgehammer_bindgen", "sledgehammer_utils"] sledgehammer = ["sledgehammer_bindgen", "sledgehammer_utils"]
web = [ webonly = [
"sledgehammer", "sledgehammer",
"wasm-bindgen", "wasm-bindgen",
"js-sys", "js-sys",
+1 -1
View File
@@ -17,7 +17,7 @@ mod write_native_mutations;
pub use write_native_mutations::*; pub use write_native_mutations::*;
// Common bindings for minimal usage. // Common bindings for minimal usage.
#[cfg(all(feature = "minimal_bindings", feature = "web"))] #[cfg(all(feature = "minimal_bindings", feature = "webonly"))]
pub mod minimal_bindings { pub mod minimal_bindings {
use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
#[wasm_bindgen(module = "/src/common.js")] #[wasm_bindgen(module = "/src/common.js")]
@@ -1,14 +1,14 @@
#[cfg(feature = "web")] #[cfg(feature = "webonly")]
use js_sys::Function; use js_sys::Function;
#[cfg(feature = "web")] #[cfg(feature = "webonly")]
use sledgehammer_bindgen::bindgen; use sledgehammer_bindgen::bindgen;
#[cfg(feature = "web")] #[cfg(feature = "webonly")]
use web_sys::Node; use web_sys::Node;
#[cfg(feature = "web")] #[cfg(feature = "webonly")]
pub const SLEDGEHAMMER_JS: &str = GENERATED_JS; pub const SLEDGEHAMMER_JS: &str = GENERATED_JS;
#[cfg(feature = "web")] #[cfg(feature = "webonly")]
#[bindgen(module)] #[bindgen(module)]
mod js { mod js {
const JS_FILE: &str = "./src/common.js"; const JS_FILE: &str = "./src/common.js";
+3 -3
View File
@@ -58,9 +58,9 @@ rocket = "0.5.0"
rocket_ws = "0.1.0" rocket_ws = "0.1.0"
tower = "0.4.13" tower = "0.4.13"
[build-dependencies] # [build-dependencies]
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] } # dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
minify-js = "0.5.6" # minify-js = "0.5.6"
[features] [features]
default = ["hot-reload"] default = ["hot-reload"]
File renamed without changes.
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-mobile" name = "dioxus-mobile"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Mobile-compatible renderer for Dioxus" description = "Mobile-compatible renderer for Dioxus"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
homepage = "https://dioxuslabs.com/learn/0.4/getting_started/mobile" homepage = "https://dioxuslabs.com/learn/0.4/getting_started/mobile"
+1 -1
View File
@@ -49,7 +49,7 @@ We're going to completely clear out the `dependencies` it generates for us, swap
name = "dioxus-ios-demo" name = "dioxus-ios-demo"
version = "0.1.0" version = "0.1.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"] authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018" edition = "2021"
# leave the `lib` declaration # leave the `lib` declaration
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-router" name = "dioxus-router"
authors = ["Jonathan Kelley", "Evan Almloff"] authors = ["Jonathan Kelley", "Evan Almloff"]
version = { workspace = true } version = { workspace = true }
edition = "2018" edition = "2021"
description = "Cross-platform router for Dioxus apps" description = "Cross-platform router for Dioxus apps"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-rsx" name = "dioxus-rsx"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley", "Evan Almloff"] authors = ["Jonathan Kelley", "Evan Almloff"]
edition = "2018" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences" description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-signals" name = "dioxus-signals"
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
version = "0.4.3" version = "0.4.3"
edition = "2018" edition = "2021"
description = "Signals for Dioxus" description = "Signals for Dioxus"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+2 -2
View File
@@ -464,7 +464,7 @@ impl<T: 'static, S: Storage<SignalData<T>>> PartialEq for Signal<T, S> {
/// Allow calling a signal with signal() syntax /// Allow calling a signal with signal() syntax
/// ///
/// Currently only limited to copy types, though could probably specialize for string/arc/rc /// Currently only limited to copy types, though could probably specialize for string/arc/rc
impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for Signal<T, S> { impl<T: Clone, S: Storage<SignalData<T>> + 'static> Deref for Signal<T, S> {
type Target = dyn Fn() -> T; type Target = dyn Fn() -> T;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
@@ -473,7 +473,7 @@ impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for Signal<T, S> {
// First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>). // First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
let uninit_callable = MaybeUninit::<Self>::uninit(); let uninit_callable = MaybeUninit::<Self>::uninit();
// Then move that value into the closure. We assume that the closure now has a in memory layout of Self. // Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
let uninit_closure = move || *Self::read(unsafe { &*uninit_callable.as_ptr() }); let uninit_closure = move || Self::read(unsafe { &*uninit_callable.as_ptr() }).clone();
// Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure. // Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
let size_of_closure = std::mem::size_of_val(&uninit_closure); let size_of_closure = std::mem::size_of_val(&uninit_closure);
+1 -1
View File
@@ -2,7 +2,7 @@
name = "dioxus-ssr" name = "dioxus-ssr"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Dioxus render-to-string" description = "Dioxus render-to-string"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
+2 -2
View File
@@ -2,7 +2,7 @@
name = "dioxus-web" name = "dioxus-web"
version = { workspace = true } version = { workspace = true }
authors = ["Jonathan Kelley"] authors = ["Jonathan Kelley"]
edition = "2018" edition = "2021"
description = "Web renderer for Dioxus using websys" description = "Web renderer for Dioxus using websys"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/" repository = "https://github.com/DioxusLabs/dioxus/"
@@ -14,7 +14,7 @@ dioxus-core = { workspace = true, features = ["serialize"] }
dioxus-html = { workspace = true, features = ["wasm-bind"] } dioxus-html = { workspace = true, features = ["wasm-bind"] }
dioxus-interpreter-js = { workspace = true, features = [ dioxus-interpreter-js = { workspace = true, features = [
"minimal_bindings", "minimal_bindings",
"web", "webonly",
] } ] }
js-sys = "0.3.56" js-sys = "0.3.56"
+1 -1
View File
@@ -9,7 +9,7 @@ use std::any::Any;
/// For a builder API, see `LaunchBuilder` defined in the `dioxus` crate. /// For a builder API, see `LaunchBuilder` defined in the `dioxus` crate.
pub fn launch( pub fn launch(
root: fn() -> Element, root: fn() -> Element,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>, contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
platform_config: Config, platform_config: Config,
) { ) {
let mut vdom = VirtualDom::new(root); let mut vdom = VirtualDom::new(root);
+8 -11
View File
@@ -54,23 +54,20 @@ struct AppProps {
} }
#[allow(unused)] #[allow(unused)]
fn app(cx: Scope<AppProps>) -> Element { fn app(props: AppProps) -> Element {
let mut count = use_signal(|| cx.props.count); let mut count = use_signal(|| props.count);
let text = use_signal(|| "...".to_string()); let mut text = use_signal(|| "...".to_string());
rsx! { rsx! {
h1 { "hello axum! {count}" } h1 { "hello axum! {count}" }
button { class: "increment-button", onclick: move |_| count += 1, "Increment" } button { class: "increment-button", onclick: move |_| count += 1, "Increment" }
button { button {
class: "server-button", class: "server-button",
onclick: move |_| { onclick: move |_| async move {
to_owned![text]; if let Ok(data) = get_server_data().await {
async move { println!("Client received: {}", data);
if let Ok(data) = get_server_data().await { text.set(data.clone());
println!("Client received: {}", data); post_server_data(data).await.unwrap();
text.set(data.clone());
post_server_data(data).await.unwrap();
}
} }
}, },
"Run a server function!" "Run a server function!"
+8 -9
View File
@@ -4,7 +4,7 @@ use dioxus::prelude::*;
fn app() -> Element { fn app() -> Element {
let mut num = use_signal(|| 0); let mut num = use_signal(|| 0);
let eval_result = use_signal(String::new); let mut eval_result = use_signal(String::new);
rsx! { rsx! {
div { div {
@@ -22,19 +22,18 @@ fn app() -> Element {
div { class: "style-div", color: "red", "colored text" } div { class: "style-div", color: "red", "colored text" }
button { button {
class: "eval-button", class: "eval-button",
onclick: move |_| { onclick: move |_| async move {
let eval = eval( let mut eval = eval(
r#" r#"
window.document.title = 'Hello from Dioxus Eval!'; window.document.title = 'Hello from Dioxus Eval!';
dioxus.send("returned eval value"); dioxus.send("returned eval value");
"#, "#,
) )
.unwrap(); .unwrap();
async move {
let result = eval.recv().await; let result = eval.recv().await;
if let Ok(serde_json::Value::String(string)) = result { if let Ok(serde_json::Value::String(string)) = result {
eval_result.set(string); eval_result.set(string);
}
} }
}, },
"Eval" "Eval"
@@ -44,5 +43,5 @@ fn app() -> Element {
} }
fn main() { fn main() {
launch_web(app); launch(app);
} }