dioxus_core/
lib.rs

1#![doc = include_str!("../README.md")]
2#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
3#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
4#![warn(missing_docs)]
5
6mod any_props;
7mod arena;
8mod diff;
9mod effect;
10mod error_boundary;
11mod events;
12mod fragment;
13mod generational_box;
14mod global_context;
15mod launch;
16mod mutations;
17mod nodes;
18mod properties;
19mod reactive_context;
20mod render_error;
21mod root_wrapper;
22mod runtime;
23mod scheduler;
24mod scope_arena;
25mod scope_context;
26mod scopes;
27mod suspense;
28mod tasks;
29mod virtual_dom;
30
31mod hotreload_utils;
32
33/// Items exported from this module are used in macros and should not be used directly.
34#[doc(hidden)]
35pub mod internal {
36    #[doc(hidden)]
37    pub use crate::hotreload_utils::{
38        DynamicLiteralPool, DynamicValuePool, FmtSegment, FmtedSegments, HotReloadAttributeValue,
39        HotReloadDynamicAttribute, HotReloadDynamicNode, HotReloadLiteral,
40        HotReloadTemplateWithLocation, HotReloadedTemplate, HotreloadedLiteral, NamedAttribute,
41        TemplateGlobalKey,
42    };
43
44    #[allow(non_snake_case)]
45    #[doc(hidden)]
46    pub fn Err<T, E>(e: E) -> Result<T, E> {
47        std::result::Result::Err(e)
48    }
49
50    pub use anyhow::__anyhow;
51
52    #[doc(hidden)]
53    pub use generational_box;
54}
55
56pub(crate) mod innerlude {
57    pub(crate) use crate::any_props::*;
58    pub use crate::arena::*;
59    pub(crate) use crate::effect::*;
60    pub use crate::error_boundary::*;
61    pub use crate::events::*;
62    pub use crate::fragment::*;
63    pub use crate::generational_box::*;
64    pub use crate::global_context::*;
65    pub use crate::launch::*;
66    pub use crate::mutations::*;
67    pub use crate::nodes::*;
68    pub use crate::properties::*;
69    pub use crate::reactive_context::*;
70    pub use crate::render_error::*;
71    pub use crate::runtime::{Runtime, RuntimeGuard};
72    pub use crate::scheduler::*;
73    pub use crate::scopes::*;
74    pub use crate::suspense::*;
75    pub use crate::tasks::*;
76    pub use crate::virtual_dom::*;
77
78    pub use anyhow::anyhow;
79    pub use anyhow::Context as AnyhowContext;
80    pub use anyhow::Error;
81    pub use anyhow::Result;
82
83    /// An [`Element`] is a possibly-none [`VNode`] created by calling `render` on [`ScopeId`] or [`ScopeState`].
84    ///
85    /// An Errored [`Element`] will propagate the error to the nearest error boundary.
86    pub type Element = std::result::Result<VNode, RenderError>;
87
88    /// A [`Component`] is a function that takes [`Properties`] and returns an [`Element`].
89    pub type Component<P = ()> = fn(P) -> Element;
90}
91
92pub use crate::innerlude::{
93    anyhow, consume_context, consume_context_from_scope, current_owner, current_scope_id,
94    fc_to_builder, generation, has_context, needs_update, needs_update_any, parent_scope,
95    provide_context, provide_create_error_boundary, provide_root_context, queue_effect,
96    remove_future, schedule_update, schedule_update_any, spawn, spawn_forever, spawn_isomorphic,
97    suspend, throw_error, try_consume_context, use_after_render, use_before_render, use_drop,
98    use_hook, use_hook_with_cleanup, with_owner, AnyValue, AnyhowContext, Attribute,
99    AttributeValue, Callback, CapturedError, Component, ComponentFunction, DynamicNode, Element,
100    ElementId, Error, ErrorBoundary, ErrorContext, Event, EventHandler, Fragment, HasAttributes,
101    IntoAttributeValue, IntoDynNode, LaunchConfig, ListenerCallback, MarkerWrapper, Mutation,
102    Mutations, NoOpMutations, OptionStringFromMarker, Properties, ReactiveContext, RenderError,
103    Result, Runtime, RuntimeGuard, ScopeId, ScopeState, SpawnIfAsync, SubscriberList, Subscribers,
104    SuperFrom, SuperInto, SuspendedFuture, SuspenseBoundary, SuspenseBoundaryProps,
105    SuspenseContext, Task, Template, TemplateAttribute, TemplateNode, VComponent, VNode,
106    VNodeInner, VPlaceholder, VText, VirtualDom, WriteMutations,
107};
108
109pub use anyhow::Ok;
110pub use const_format;