Get cargo check --all working

This commit is contained in:
Jonathan Kelley 2024-01-18 19:27:55 -08:00
parent d8af9b7ed1
commit 6ed3aafb2f
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
34 changed files with 80 additions and 122 deletions

41
Cargo.lock generated
View file

@ -83,15 +83,6 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
[[package]]
name = "aho-corasick"
version = "1.1.2"
@ -2461,7 +2452,6 @@ dependencies = [
"futures-util",
"global-hotkey",
"infer 0.11.0",
"minify-js",
"muda",
"objc",
"objc_id",
@ -2653,7 +2643,6 @@ dependencies = [
"dioxus-interpreter-js",
"futures-channel",
"futures-util",
"minify-js",
"once_cell",
"pretty_env_logger",
"rocket",
@ -4123,7 +4112,7 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
dependencies = [
"aho-corasick 1.1.2",
"aho-corasick",
"bstr 1.9.0",
"log",
"regex-automata 0.4.3",
@ -4462,7 +4451,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.7",
"bumpalo",
]
[[package]]
@ -5960,16 +5948,6 @@ dependencies = [
"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]]
name = "minimal-lexical"
version = "0.2.1"
@ -6699,19 +6677,6 @@ dependencies = [
"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]]
name = "password-hash"
version = "0.4.2"
@ -7666,7 +7631,7 @@ version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick 1.1.2",
"aho-corasick",
"memchr",
"regex-automata 0.4.3",
"regex-syntax 0.8.2",
@ -7687,7 +7652,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick 1.1.2",
"aho-corasick",
"memchr",
"regex-syntax 0.8.2",
]

View file

@ -5,7 +5,7 @@ fn main() {
wasm_logger::init(wasm_logger::Config::default());
console_error_panic_hook::set_once();
dioxus_web::launch(app);
launch(app);
}
fn app() -> Element {

View file

@ -2,7 +2,7 @@
name = "mobile-demo"
version = "0.1.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018"
edition = "2021"
[lib]
crate-type = ["staticlib", "cdylib", "rlib"]

View file

@ -83,5 +83,5 @@ fn App() -> Element {
}
fn main() {
dioxus_web::launch(App);
launch(App);
}

View file

@ -88,7 +88,7 @@ interprocess-docfix = { version = "1.2.2" }
gitignore = "1.0.8"
[features]
default = ["plugin"]
default = []
plugin = ["mlua"]
[[bin]]

View file

@ -2,7 +2,7 @@
name = "dioxus-core"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-desktop"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "WebView renderer for Dioxus"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"
@ -83,8 +83,8 @@ dioxus = { workspace = true, features = ["launch", "desktop"]}
exitcode = "1.1.2"
[build-dependencies]
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
minify-js = "0.5.6"
# dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
# minify-js = "0.5.6"
# These tests need to be run on the main thread, so they cannot use rust's test harness.
[[test]]

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.
pub fn launch(
root: fn() -> Element,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
platform_config: Config,
) {
let mut virtual_dom = VirtualDom::new(root);

View file

@ -16,10 +16,10 @@ pub struct LaunchBuilder<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>>;
#[cfg(not(feature = "fullstack"))]
type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any>>>;
// #[cfg(not(feature = "fullstack"))]
// type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any>>>;
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.

View file

@ -2,7 +2,7 @@
name = "fermi"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Global state management for Dioxus"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"
homepage = "https://dioxuslabs.com"
keywords = ["ui", "gui", "react", "ssr", "fullstack"]
resolver = "2"
[dependencies]
# server functions

View file

@ -9,7 +9,7 @@ use dioxus_fullstack::prelude::*;
use dioxus_router::prelude::*;
fn main() {
let config = LaunchBuilder::<FullstackRouterConfig<Route>>::router();
let config = LaunchBuilder::fullstack();
#[cfg(feature = "ssr")]
config
.incremental(
@ -19,7 +19,12 @@ fn main() {
.launch();
#[cfg(not(feature = "ssr"))]
config.launch();
config.launch(|| {
rsx! {
Router::<Route> {
}
}
});
}
#[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" }
table {
tbody {
for _ in 0..*id {
for _ in 0..id {
tr {
for _ in 0..*id {
for _ in 0..id {
td { "hello world!" }
}
}
@ -56,7 +61,7 @@ fn Home() -> Element {
rsx! {
Link {
to: Route::Blog {
id: *count.get()
id: count()
},
"Go to blog"
}

View file

@ -9,34 +9,25 @@ use dioxus::prelude::*;
use dioxus_fullstack::{launch, prelude::*};
use serde::{Deserialize, Serialize};
#[derive(Props, PartialEq, Debug, Default, Serialize, Deserialize, Clone)]
struct AppProps {
count: i32,
}
fn app(cx: Scope<AppProps>) -> Element {
let state =
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
fn app() -> Element {
let state = use_server_future(move || async move { get_server_data().await.unwrap() });
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
let mut text = use_signal(|| "...".to_string());
rsx! {
div {
"Server state: {state}"
"Server state: {state.unwrap().value().clone()}"
}
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
button {
onclick: move |_| {
to_owned![text];
async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(data).await.unwrap();
}
onclick: move |_| async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(data).await.unwrap();
}
},
"Run a server function!"
@ -63,5 +54,5 @@ fn main() {
#[cfg(feature = "ssr")]
tracing_subscriber::fmt::init();
LaunchBuilder::new_with_props(app, AppProps { count: 0 }).launch()
LaunchBuilder::fullstack().launch(app);
}

View file

@ -66,8 +66,8 @@ pub mod prelude {
}
// 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.");
#[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.");

View file

@ -2,7 +2,7 @@
name = "generational-box"
authors = ["Evan Almloff"]
version = "0.4.3"
edition = "2018"
edition = "2021"
description = "A box backed by a generational runtime"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-hooks"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Basic useful hooks for Dioxus."
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-html"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "HTML Element pack for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -1,7 +1,7 @@
[package]
name = "dioxus-interpreter-js"
version = { workspace = true }
edition = "2018"
edition = "2021"
authors = ["Jonathan Kelley"]
description = "JS Intepreter for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
license = "MIT OR Apache-2.0"
@ -28,7 +28,7 @@ dioxus-html = { workspace = true, optional = true }
default = []
serialize = ["serde"]
sledgehammer = ["sledgehammer_bindgen", "sledgehammer_utils"]
web = [
webonly = [
"sledgehammer",
"wasm-bindgen",
"js-sys",

View file

@ -17,7 +17,7 @@ mod write_native_mutations;
pub use write_native_mutations::*;
// Common bindings for minimal usage.
#[cfg(all(feature = "minimal_bindings", feature = "web"))]
#[cfg(all(feature = "minimal_bindings", feature = "webonly"))]
pub mod minimal_bindings {
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
#[wasm_bindgen(module = "/src/common.js")]

View file

@ -1,14 +1,14 @@
#[cfg(feature = "web")]
#[cfg(feature = "webonly")]
use js_sys::Function;
#[cfg(feature = "web")]
#[cfg(feature = "webonly")]
use sledgehammer_bindgen::bindgen;
#[cfg(feature = "web")]
#[cfg(feature = "webonly")]
use web_sys::Node;
#[cfg(feature = "web")]
#[cfg(feature = "webonly")]
pub const SLEDGEHAMMER_JS: &str = GENERATED_JS;
#[cfg(feature = "web")]
#[cfg(feature = "webonly")]
#[bindgen(module)]
mod js {
const JS_FILE: &str = "./src/common.js";

View file

@ -58,9 +58,9 @@ rocket = "0.5.0"
rocket_ws = "0.1.0"
tower = "0.4.13"
[build-dependencies]
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
minify-js = "0.5.6"
# [build-dependencies]
# dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
# minify-js = "0.5.6"
[features]
default = ["hot-reload"]

View file

@ -2,7 +2,7 @@
name = "dioxus-mobile"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Mobile-compatible renderer for Dioxus"
repository = "https://github.com/DioxusLabs/dioxus/"
homepage = "https://dioxuslabs.com/learn/0.4/getting_started/mobile"

View file

@ -49,7 +49,7 @@ We're going to completely clear out the `dependencies` it generates for us, swap
name = "dioxus-ios-demo"
version = "0.1.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018"
edition = "2021"
# leave the `lib` declaration

View file

@ -2,7 +2,7 @@
name = "dioxus-router"
authors = ["Jonathan Kelley", "Evan Almloff"]
version = { workspace = true }
edition = "2018"
edition = "2021"
description = "Cross-platform router for Dioxus apps"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-rsx"
version = { workspace = true }
authors = ["Jonathan Kelley", "Evan Almloff"]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-signals"
authors = ["Jonathan Kelley"]
version = "0.4.3"
edition = "2018"
edition = "2021"
description = "Signals for Dioxus"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

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
///
/// 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;
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>).
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.
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.
let size_of_closure = std::mem::size_of_val(&uninit_closure);

View file

@ -2,7 +2,7 @@
name = "dioxus-ssr"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Dioxus render-to-string"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"

View file

@ -2,7 +2,7 @@
name = "dioxus-web"
version = { workspace = true }
authors = ["Jonathan Kelley"]
edition = "2018"
edition = "2021"
description = "Web renderer for Dioxus using websys"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"
@ -14,7 +14,7 @@ dioxus-core = { workspace = true, features = ["serialize"] }
dioxus-html = { workspace = true, features = ["wasm-bind"] }
dioxus-interpreter-js = { workspace = true, features = [
"minimal_bindings",
"web",
"webonly",
] }
js-sys = "0.3.56"

View file

@ -9,7 +9,7 @@ use std::any::Any;
/// For a builder API, see `LaunchBuilder` defined in the `dioxus` crate.
pub fn launch(
root: fn() -> Element,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
platform_config: Config,
) {
let mut vdom = VirtualDom::new(root);

View file

@ -54,23 +54,20 @@ struct AppProps {
}
#[allow(unused)]
fn app(cx: Scope<AppProps>) -> Element {
let mut count = use_signal(|| cx.props.count);
let text = use_signal(|| "...".to_string());
fn app(props: AppProps) -> Element {
let mut count = use_signal(|| props.count);
let mut text = use_signal(|| "...".to_string());
rsx! {
h1 { "hello axum! {count}" }
button { class: "increment-button", onclick: move |_| count += 1, "Increment" }
button {
class: "server-button",
onclick: move |_| {
to_owned![text];
async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(data).await.unwrap();
}
onclick: move |_| async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(data).await.unwrap();
}
},
"Run a server function!"

View file

@ -4,7 +4,7 @@ use dioxus::prelude::*;
fn app() -> Element {
let mut num = use_signal(|| 0);
let eval_result = use_signal(String::new);
let mut eval_result = use_signal(String::new);
rsx! {
div {
@ -22,19 +22,18 @@ fn app() -> Element {
div { class: "style-div", color: "red", "colored text" }
button {
class: "eval-button",
onclick: move |_| {
let eval = eval(
onclick: move |_| async move {
let mut eval = eval(
r#"
window.document.title = 'Hello from Dioxus Eval!';
dioxus.send("returned eval value");
"#,
)
.unwrap();
async move {
let result = eval.recv().await;
if let Ok(serde_json::Value::String(string)) = result {
eval_result.set(string);
}
let result = eval.recv().await;
if let Ok(serde_json::Value::String(string)) = result {
eval_result.set(string);
}
},
"Eval"
@ -44,5 +43,5 @@ fn app() -> Element {
}
fn main() {
launch_web(app);
launch(app);
}