dioxus/packages/core/src/lib.rs

96 lines
2.8 KiB
Rust
Raw Normal View History

2022-11-30 15:31:44 +00:00
#![doc = include_str!("../README.md")]
2022-12-01 04:54:30 +00:00
#![warn(missing_docs)]
2022-11-30 15:31:44 +00:00
mod any_props;
mod arena;
mod bump_frame;
mod create;
mod diff;
2022-11-23 02:38:27 +00:00
mod dirty_scope;
mod error_boundary;
2022-11-02 01:42:29 +00:00
mod events;
2022-11-20 01:07:29 +00:00
mod fragment;
2022-11-02 01:42:29 +00:00
mod lazynodes;
mod mutations;
mod nodes;
2022-11-03 00:29:18 +00:00
mod properties;
2022-11-06 08:48:34 +00:00
mod scheduler;
mod scope_arena;
mod scopes;
2022-11-09 03:39:37 +00:00
mod virtual_dom;
2022-11-23 03:59:56 +00:00
2022-11-02 01:42:29 +00:00
pub(crate) mod innerlude {
2022-11-03 08:38:18 +00:00
pub use crate::arena::*;
2022-11-23 02:38:27 +00:00
pub use crate::dirty_scope::*;
2022-11-29 21:31:04 +00:00
pub use crate::error_boundary::*;
2022-11-02 01:42:29 +00:00
pub use crate::events::*;
2022-11-20 01:07:29 +00:00
pub use crate::fragment::*;
2022-11-03 00:29:18 +00:00
pub use crate::lazynodes::*;
2022-11-02 01:42:29 +00:00
pub use crate::mutations::*;
2022-12-03 00:24:49 +00:00
pub use crate::nodes::RenderReturn;
2022-11-02 01:42:29 +00:00
pub use crate::nodes::*;
2022-11-03 00:29:18 +00:00
pub use crate::properties::*;
2022-11-06 08:48:34 +00:00
pub use crate::scheduler::*;
2022-11-02 01:42:29 +00:00
pub use crate::scopes::*;
2022-11-09 03:39:37 +00:00
pub use crate::virtual_dom::*;
2021-02-12 05:29:46 +00:00
/// An [`Element`] is a possibly-none [`VNode`] created by calling `render` on [`Scope`] or [`ScopeState`].
2022-11-03 08:38:18 +00:00
///
2022-11-23 02:38:27 +00:00
/// An Errored [`Element`] will propagate the error to the nearest error boundary.
pub type Element<'a> = Option<VNode<'a>>;
2021-08-31 16:28:44 +00:00
2022-11-02 01:42:29 +00:00
/// A [`Component`] is a function that takes a [`Scope`] and returns an [`Element`].
///
/// Components can be used in other components with two syntax options:
/// - lowercase as a function call with named arguments (rust style)
/// - uppercase as an element (react style)
///
/// ## Rust-Style
///
/// ```rust, ignore
/// fn example(cx: Scope<Props>) -> Element {
/// // ...
/// }
///
/// rsx!(
/// example()
/// )
/// ```
/// ## React-Style
/// ```rust, ignore
/// fn Example(cx: Scope<Props>) -> Element {
/// // ...
/// }
///
/// rsx!(
/// Example {}
/// )
/// ```
pub type Component<P = ()> = fn(Scope<P>) -> Element;
}
2021-12-21 03:33:13 +00:00
2022-11-02 01:42:29 +00:00
pub use crate::innerlude::{
fc_to_builder, AnyValue, Attribute, AttributeValue, BorrowedAttributeValue, CapturedError,
2023-02-08 23:51:28 +00:00
Component, DynamicNode, Element, ElementId, Event, Fragment, IntoDynNode, LazyNodes, Mutation,
Mutations, Properties, RenderReturn, Scope, ScopeId, ScopeState, Scoped, SuspenseContext,
TaskId, Template, TemplateAttribute, TemplateNode, VComponent, VNode, VPlaceholder, VText,
VirtualDom,
2022-11-02 01:42:29 +00:00
};
2022-03-02 22:56:12 +00:00
2022-11-02 01:42:29 +00:00
/// The purpose of this module is to alleviate imports of many common types
///
/// This includes types like [`Scope`], [`Element`], and [`Component`].
pub mod prelude {
pub use crate::innerlude::{
2023-01-03 03:26:12 +00:00
fc_to_builder, AnyValue, Component, Element, Event, EventHandler, Fragment,
IntoAttributeValue, LazyNodes, Properties, Scope, ScopeId, ScopeState, Scoped, TaskId,
Template, TemplateAttribute, TemplateNode, Throw, VNode, VirtualDom,
2022-11-02 01:42:29 +00:00
};
}
2022-11-02 01:42:29 +00:00
pub mod exports {
//! Important dependencies that are used by the rest of the library
//! Feel free to just add the dependencies in your own Crates.toml
pub use bumpalo;
}