make anyprops and vprops private again
This commit is contained in:
1 parent
53380c9956
commit
c3edf99b63
5 files changed
+13
-19
No files matched your search
@@ -4,7 +4,7 @@ use std::{any::Any, panic::AssertUnwindSafe};
|
|||||||
pub(crate) type BoxedAnyProps = Box<dyn AnyProps>;
|
pub(crate) type BoxedAnyProps = Box<dyn AnyProps>;
|
||||||
|
|
||||||
/// A trait for a component that can be rendered.
|
/// A trait for a component that can be rendered.
|
||||||
pub trait AnyProps: 'static {
|
pub(crate) trait AnyProps: 'static {
|
||||||
/// Render the component with the internal props.
|
/// Render the component with the internal props.
|
||||||
fn render(&self) -> RenderReturn;
|
fn render(&self) -> RenderReturn;
|
||||||
/// Check if the props are the same as the type erased props of another component.
|
/// Check if the props are the same as the type erased props of another component.
|
||||||
@@ -16,7 +16,7 @@ pub trait AnyProps: 'static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A component along with the props the component uses to render.
|
/// A component along with the props the component uses to render.
|
||||||
pub struct VProps<F: ComponentFunction<P, M>, P, M> {
|
pub(crate) struct VProps<F: ComponentFunction<P, M>, P, M> {
|
||||||
render_fn: F,
|
render_fn: F,
|
||||||
memo: fn(&P, &P) -> bool,
|
memo: fn(&P, &P) -> bool,
|
||||||
props: P,
|
props: P,
|
||||||
@@ -52,11 +52,6 @@ impl<F: ComponentFunction<P, M> + Clone, P: Clone + 'static, M: 'static> VProps<
|
|||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current props of the VProps object
|
|
||||||
pub fn props(&self) -> &P {
|
|
||||||
&self.props
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: ComponentFunction<P, M> + Clone, P: Clone + 'static, M: 'static> AnyProps
|
impl<F: ComponentFunction<P, M> + Clone, P: Clone + 'static, M: 'static> AnyProps
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ mod tasks;
|
|||||||
mod virtual_dom;
|
mod virtual_dom;
|
||||||
|
|
||||||
pub(crate) mod innerlude {
|
pub(crate) mod innerlude {
|
||||||
pub use crate::any_props::*;
|
pub(crate) use crate::any_props::*;
|
||||||
pub use crate::arena::*;
|
pub use crate::arena::*;
|
||||||
pub use crate::dirty_scope::*;
|
pub use crate::dirty_scope::*;
|
||||||
pub use crate::error_boundary::*;
|
pub use crate::error_boundary::*;
|
||||||
@@ -74,11 +74,11 @@ pub(crate) mod innerlude {
|
|||||||
|
|
||||||
pub use crate::innerlude::{
|
pub use crate::innerlude::{
|
||||||
fc_to_builder, generation, schedule_update, schedule_update_any, use_hook, vdom_is_rendering,
|
fc_to_builder, generation, schedule_update, schedule_update_any, use_hook, vdom_is_rendering,
|
||||||
AnyProps, AnyValue, Attribute, AttributeValue, CapturedError, Component, ComponentFunction,
|
AnyValue, Attribute, AttributeValue, CapturedError, Component, ComponentFunction, DynamicNode,
|
||||||
DynamicNode, Element, ElementId, Event, Fragment, HasAttributes, IntoDynNode, Mutation,
|
Element, ElementId, Event, Fragment, HasAttributes, IntoDynNode, Mutation, Mutations,
|
||||||
Mutations, NoOpMutations, Properties, RenderReturn, Runtime, ScopeId, ScopeState, Task,
|
NoOpMutations, Properties, RenderReturn, Runtime, ScopeId, ScopeState, Task, Template,
|
||||||
Template, TemplateAttribute, TemplateNode, VComponent, VNode, VNodeInner, VPlaceholder, VProps,
|
TemplateAttribute, TemplateNode, VComponent, VNode, VNodeInner, VPlaceholder, VText,
|
||||||
VText, VirtualDom, WriteMutations,
|
VirtualDom, WriteMutations,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The purpose of this module is to alleviate imports of many common types
|
/// The purpose of this module is to alleviate imports of many common types
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::{any_props::BoxedAnyProps, innerlude::ScopeState, VProps};
|
use crate::innerlude::VProps;
|
||||||
|
use crate::{any_props::BoxedAnyProps, innerlude::ScopeState};
|
||||||
use crate::{arena::ElementId, Element, Event};
|
use crate::{arena::ElementId, Element, Event};
|
||||||
use crate::{
|
use crate::{
|
||||||
innerlude::{ElementRef, EventHandler, MountId},
|
innerlude::{ElementRef, EventHandler, MountId},
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ use crate::{
|
|||||||
arena::ElementId,
|
arena::ElementId,
|
||||||
innerlude::{
|
innerlude::{
|
||||||
DirtyScope, ElementRef, ErrorBoundary, NoOpMutations, SchedulerMsg, ScopeState, VNodeMount,
|
DirtyScope, ElementRef, ErrorBoundary, NoOpMutations, SchedulerMsg, ScopeState, VNodeMount,
|
||||||
WriteMutations,
|
VProps, WriteMutations,
|
||||||
},
|
},
|
||||||
nodes::RenderReturn,
|
nodes::RenderReturn,
|
||||||
nodes::{Template, TemplateId},
|
nodes::{Template, TemplateId},
|
||||||
runtime::{Runtime, RuntimeGuard},
|
runtime::{Runtime, RuntimeGuard},
|
||||||
scopes::ScopeId,
|
scopes::ScopeId,
|
||||||
AttributeValue, ComponentFunction, Element, Event, Mutations, Task, VProps,
|
AttributeValue, ComponentFunction, Element, Event, Mutations, Task,
|
||||||
};
|
};
|
||||||
use futures_util::{pin_mut, StreamExt};
|
use futures_util::{pin_mut, StreamExt};
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
@@ -303,7 +303,7 @@ impl VirtualDom {
|
|||||||
/// let mut dom = VirtualDom::new_from_root(VComponent::new(Example, SomeProps { name: "jane" }, "Example"));
|
/// let mut dom = VirtualDom::new_from_root(VComponent::new(Example, SomeProps { name: "jane" }, "Example"));
|
||||||
/// let mutations = dom.rebuild();
|
/// let mutations = dom.rebuild();
|
||||||
/// ```
|
/// ```
|
||||||
pub fn new_with_component(root: impl AnyProps + 'static) -> Self {
|
pub(crate) fn new_with_component(root: impl AnyProps + 'static) -> Self {
|
||||||
let (tx, rx) = futures_channel::mpsc::unbounded();
|
let (tx, rx) = futures_channel::mpsc::unbounded();
|
||||||
|
|
||||||
let mut dom = Self {
|
let mut dom = Self {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use dioxus_core::AnyProps;
|
|
||||||
use dioxus_core::VProps;
|
|
||||||
|
|
||||||
/// A builder for a fullstack app.
|
/// A builder for a fullstack app.
|
||||||
pub struct LaunchBuilder<Cfg: 'static = (), ContextFn: ?Sized = ValidContext> {
|
pub struct LaunchBuilder<Cfg: 'static = (), ContextFn: ?Sized = ValidContext> {
|
||||||
|
|||||||
Reference in new issue
Block a user