Fix the router and stub out a number of crates to get compiling
This commit is contained in:
226 files changed
+1057
-1482
No files matched your search
@@ -62,8 +62,8 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let meaning = use_state(cx, || None);
|
||||
fn app() -> Element {
|
||||
let meaning = use_state(|| None);
|
||||
cx.render(rsx! {
|
||||
button {
|
||||
onclick: move |_| {
|
||||
|
||||
@@ -74,9 +74,9 @@ fn main() {
|
||||
}
|
||||
}
|
||||
//
|
||||
fn app(cx: Scope) -> Element {
|
||||
let user_name = use_state(cx, || "?".to_string());
|
||||
let permissions = use_state(cx, || "?".to_string());
|
||||
fn app() -> Element {
|
||||
let user_name = use_state(|| "?".to_string());
|
||||
let permissions = use_state(|| "?".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_fullstack::prelude::*;
|
||||
|
||||
pub fn app(cx: Scope) -> Element {
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
pub fn app() -> Element {
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
h1 { "High-Five counter: {count}" }
|
||||
|
||||
@@ -20,10 +20,10 @@ struct AppProps {
|
||||
|
||||
fn app(cx: Scope<AppProps>) -> Element {
|
||||
let state =
|
||||
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
let eval = use_eval(cx);
|
||||
|
||||
cx.render(rsx! {
|
||||
|
||||
@@ -32,7 +32,7 @@ enum Route {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Blog(cx: Scope, id: i32) -> Element {
|
||||
fn Blog(id: i32) -> Element {
|
||||
render! {
|
||||
Link { to: Route::Home {}, "Go to counter" }
|
||||
table {
|
||||
@@ -50,9 +50,9 @@ fn Blog(cx: Scope, id: i32) -> Element {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Home(cx: Scope) -> Element {
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
fn Home() -> Element {
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
Link {
|
||||
|
||||
@@ -17,10 +17,10 @@ struct AppProps {
|
||||
|
||||
fn app(cx: Scope<AppProps>) -> Element {
|
||||
let state =
|
||||
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -50,7 +50,7 @@ enum Route {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Blog(cx: Scope) -> Element {
|
||||
fn Blog() -> Element {
|
||||
render! {
|
||||
Link { to: Route::Home {}, "Go to counter" }
|
||||
table {
|
||||
@@ -68,9 +68,9 @@ fn Blog(cx: Scope) -> Element {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Home(cx: Scope) -> Element {
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
fn Home() -> Element {
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
Link {
|
||||
|
||||
@@ -17,10 +17,10 @@ struct AppProps {
|
||||
|
||||
fn app(cx: Scope<AppProps>) -> Element {
|
||||
let state =
|
||||
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
|
||||
|
||||
let mut count = use_state(cx, || 0);
|
||||
let text = use_state(cx, || "...".to_string());
|
||||
let mut count = use_state(|| 0);
|
||||
let text = use_state(|| "...".to_string());
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! fn app(cx: Scope) -> Element {
|
||||
//! let text = use_state(cx, || "...".to_string());
|
||||
//! fn app() -> Element {
|
||||
//! let text = use_state(|| "...".to_string());
|
||||
//!
|
||||
//! cx.render(rsx! {
|
||||
//! button {
|
||||
@@ -182,7 +182,7 @@ pub trait DioxusRouterExt<S> {
|
||||
/// .unwrap();
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// todo!()
|
||||
/// }
|
||||
/// ```
|
||||
@@ -211,7 +211,7 @@ pub trait DioxusRouterExt<S> {
|
||||
/// .unwrap();
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// todo!()
|
||||
/// }
|
||||
/// ```
|
||||
@@ -379,7 +379,7 @@ fn apply_request_parts_to_response<B>(
|
||||
/// use dioxus::prelude::*;
|
||||
/// use dioxus_fullstack::{axum_adapter::render_handler_with_context, prelude::*};
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// render! {
|
||||
/// "hello!"
|
||||
/// }
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! fn app(cx: Scope) -> Element {
|
||||
//! let text = use_state(cx, || "...".to_string());
|
||||
//! fn app() -> Element {
|
||||
//! let text = use_state(|| "...".to_string());
|
||||
//!
|
||||
//! cx.render(rsx! {
|
||||
//! button {
|
||||
@@ -199,7 +199,7 @@ pub trait DioxusRouterExt {
|
||||
/// .await;
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {todo!()}
|
||||
/// fn app() -> Element {todo!()}
|
||||
/// ```
|
||||
fn serve_dioxus_application<P: Clone + serde::Serialize + Send + Sync + 'static>(
|
||||
self,
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! fn app(cx: Scope) -> Element {
|
||||
//! let text = use_state(cx, || "...".to_string());
|
||||
//! fn app() -> Element {
|
||||
//! let text = use_state(|| "...".to_string());
|
||||
//!
|
||||
//! cx.render(rsx! {
|
||||
//! button {
|
||||
@@ -175,7 +175,7 @@ pub fn register_server_fns(server_fn_route: &'static str) -> BoxedFilter<(impl R
|
||||
/// warp::serve(routes).run(([127, 0, 0, 1], 8080)).await;
|
||||
/// }
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// fn app() -> Element {
|
||||
/// todo!()
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@@ -11,8 +11,8 @@ use serde::{de::DeserializeOwned, Serialize};
|
||||
/// use dioxus::prelude::*;
|
||||
/// use dioxus_fullstack::prelude::*;
|
||||
///
|
||||
/// fn app(cx: Scope) -> Element {
|
||||
/// let state1 = server_cached(cx, || from_server(|| {
|
||||
/// fn app() -> Element {
|
||||
/// let state1 = server_cached(|| from_server(|| {
|
||||
/// 1234
|
||||
/// }));
|
||||
///
|
||||
|
||||
@@ -24,7 +24,6 @@ use std::sync::Arc;
|
||||
/// - dependencies: a tuple of references to values that are PartialEq + Clone
|
||||
#[must_use = "Consider using `cx.spawn` to run a future without reading its value"]
|
||||
pub fn use_server_future<T, F, D>(
|
||||
cx: &ScopeState,
|
||||
dependencies: D,
|
||||
future: impl FnOnce(D::Out) -> F,
|
||||
) -> Option<&UseServerFuture<T>>
|
||||
@@ -128,7 +127,7 @@ impl<T> UseServerFuture<T> {
|
||||
}
|
||||
|
||||
/// Forcefully cancel a future
|
||||
pub fn cancel(&self, cx: &ScopeState) {
|
||||
pub fn cancel(&self) {
|
||||
if let Some(task) = self.task.take() {
|
||||
cx.remove_future(task);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,9 @@ use tokio::sync::{
|
||||
#[derive(Clone)]
|
||||
pub struct HotReloadState {
|
||||
// The cache of all templates that have been modified since the last time we checked
|
||||
pub(crate) templates:
|
||||
Arc<RwLock<std::collections::HashSet<dioxus::prelude::Template<'static>>>>,
|
||||
pub(crate) templates: Arc<RwLock<std::collections::HashSet<dioxus::prelude::Template>>>,
|
||||
// The channel to send messages to the hot reload thread
|
||||
pub(crate) message_receiver: Receiver<Option<Template<'static>>>,
|
||||
pub(crate) message_receiver: Receiver<Option<Template>>,
|
||||
}
|
||||
|
||||
impl Default for HotReloadState {
|
||||
|
||||
@@ -49,7 +49,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn default_external_navigation_handler() -> fn(Scope) -> Element {
|
||||
fn default_external_navigation_handler() -> fn() -> Element {
|
||||
dioxus_router::prelude::FailureExternalNavigation
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ where
|
||||
{
|
||||
#[serde(skip)]
|
||||
#[serde(default = "default_external_navigation_handler")]
|
||||
failure_external_navigation: fn(Scope) -> Element,
|
||||
failure_external_navigation: fn() -> Element,
|
||||
scroll_restoration: bool,
|
||||
#[serde(skip)]
|
||||
phantom: std::marker::PhantomData<R>,
|
||||
|
||||
Reference in new issue
Block a user