codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -4,7 +4,7 @@ use crate::{
|
||||
events::ListenerCallback,
|
||||
innerlude::{ElementRef, MountId, ScopeState, VProps},
|
||||
properties::ComponentFunction,
|
||||
Element, Event, Properties, RenderError, ScopeId, VirtualDom,
|
||||
Element, Event, Properties, ScopeId, VirtualDom,
|
||||
};
|
||||
use dioxus_core_types::DioxusFormattable;
|
||||
use std::ops::Deref;
|
||||
@@ -100,55 +100,6 @@ pub struct VNode {
|
||||
pub(crate) mount: Cell<MountId>,
|
||||
}
|
||||
|
||||
impl AsRef<VNode> for Element {
|
||||
fn as_ref(&self) -> &VNode {
|
||||
match self {
|
||||
Element::Ok(node) => node,
|
||||
Element::Err(RenderError::Aborted(err)) => &err.render,
|
||||
Element::Err(RenderError::Suspended(fut)) => &fut.placeholder,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Element> for VNode {
|
||||
fn from(val: &Element) -> Self {
|
||||
AsRef::as_ref(val).clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Element> for VNode {
|
||||
fn from(val: Element) -> Self {
|
||||
match val {
|
||||
Element::Ok(node) => node,
|
||||
Element::Err(RenderError::Aborted(err)) => err.render,
|
||||
Element::Err(RenderError::Suspended(fut)) => fut.placeholder,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A tiny helper trait to get the vnode for a Element
|
||||
pub(crate) trait AsVNode {
|
||||
/// Get the vnode for this element
|
||||
fn as_vnode(&self) -> &VNode;
|
||||
|
||||
/// Create a deep clone of this VNode
|
||||
fn deep_clone(&self) -> Self;
|
||||
}
|
||||
|
||||
impl AsVNode for Element {
|
||||
fn as_vnode(&self) -> &VNode {
|
||||
AsRef::as_ref(self)
|
||||
}
|
||||
|
||||
fn deep_clone(&self) -> Self {
|
||||
match self {
|
||||
Ok(node) => Ok(node.deep_clone()),
|
||||
Err(RenderError::Aborted(err)) => Err(RenderError::Aborted(err.deep_clone())),
|
||||
Err(RenderError::Suspended(fut)) => Err(RenderError::Suspended(fut.deep_clone())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for VNode {
|
||||
fn default() -> Self {
|
||||
Self::placeholder()
|
||||
@@ -979,7 +930,7 @@ impl IntoVNode for Element {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self {
|
||||
Ok(val) => val.into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -987,7 +938,7 @@ impl IntoVNode for &Element {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self {
|
||||
Ok(val) => val.into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -995,7 +946,7 @@ impl IntoVNode for Option<VNode> {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self {
|
||||
Some(val) => val.into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1003,7 +954,7 @@ impl IntoVNode for &Option<VNode> {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self.as_ref() {
|
||||
Some(val) => val.clone().into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1011,7 +962,7 @@ impl IntoVNode for Option<Element> {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self {
|
||||
Some(val) => val.into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,7 +970,7 @@ impl IntoVNode for &Option<Element> {
|
||||
fn into_vnode(self) -> VNode {
|
||||
match self.as_ref() {
|
||||
Some(val) => val.clone().into_vnode(),
|
||||
_ => VNode::empty().unwrap(),
|
||||
_ => VNode::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user