lib.rs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. mod any_props;
  6. mod arena;
  7. mod diff;
  8. mod effect;
  9. mod error_boundary;
  10. mod events;
  11. mod fragment;
  12. mod generational_box;
  13. mod global_context;
  14. mod mutations;
  15. mod nodes;
  16. mod properties;
  17. mod render_signal;
  18. mod runtime;
  19. mod scheduler;
  20. mod scope_arena;
  21. mod scope_context;
  22. mod scopes;
  23. mod tasks;
  24. mod virtual_dom;
  25. pub(crate) mod innerlude {
  26. pub(crate) use crate::any_props::*;
  27. pub use crate::arena::*;
  28. pub(crate) use crate::effect::*;
  29. pub use crate::error_boundary::*;
  30. pub use crate::events::*;
  31. pub use crate::fragment::*;
  32. pub use crate::generational_box::*;
  33. pub use crate::global_context::*;
  34. pub use crate::mutations::*;
  35. pub use crate::nodes::*;
  36. pub use crate::properties::*;
  37. pub use crate::runtime::{Runtime, RuntimeGuard};
  38. pub use crate::scheduler::*;
  39. pub use crate::scopes::*;
  40. pub use crate::tasks::*;
  41. pub use crate::virtual_dom::*;
  42. /// An [`Element`] is a possibly-none [`VNode`] created by calling `render` on [`Scope`] or [`ScopeState`].
  43. ///
  44. /// An Errored [`Element`] will propagate the error to the nearest error boundary.
  45. pub type Element = Option<VNode>;
  46. /// A [`Component`] is a function that takes [`Properties`] and returns an [`Element`].
  47. pub type Component<P = ()> = fn(P) -> Element;
  48. }
  49. pub use crate::innerlude::{
  50. fc_to_builder, generation, schedule_update, schedule_update_any, use_hook, vdom_is_rendering,
  51. AnyValue, Attribute, AttributeValue, CapturedError, Component, ComponentFunction, DynamicNode,
  52. Element, ElementId, Event, Fragment, HasAttributes, IntoDynNode, Mutation, Mutations,
  53. NoOpMutations, Properties, RenderReturn, Runtime, ScopeId, ScopeState, Task, Template,
  54. TemplateAttribute, TemplateNode, VComponent, VNode, VNodeInner, VPlaceholder, VText,
  55. VirtualDom, WriteMutations,
  56. };
  57. /// The purpose of this module is to alleviate imports of many common types
  58. ///
  59. /// This includes types like [`Element`], and [`Component`].
  60. pub mod prelude {
  61. pub use crate::innerlude::{
  62. consume_context, consume_context_from_scope, current_owner, current_scope_id,
  63. fc_to_builder, generation, has_context, needs_update, needs_update_any, parent_scope,
  64. provide_context, provide_root_context, queue_effect, remove_future, schedule_update,
  65. schedule_update_any, spawn, spawn_forever, spawn_isomorphic, suspend, try_consume_context,
  66. use_after_render, use_before_render, use_drop, use_error_boundary, use_hook,
  67. use_hook_with_cleanup, wait_for_next_render, with_owner, AnyValue, Attribute, Component,
  68. ComponentFunction, Element, ErrorBoundary, Event, EventHandler, Fragment, HasAttributes,
  69. IntoAttributeValue, IntoDynNode, OptionStringFromMarker, Properties, Runtime, RuntimeGuard,
  70. ScopeId, ScopeState, SuperFrom, SuperInto, Task, Template, TemplateAttribute, TemplateNode,
  71. Throw, VNode, VNodeInner, VirtualDom,
  72. };
  73. }