Skip to main content

Crate egui_reactor

Crate egui_reactor 

Source
Expand description

Core of egui-reactor: View, Cx, Store, State, Handle, Dispatch, the hooks and the layout and paint attribute types.

rsx!, #[component] and #[hook] come from egui-reactor-macros and are re-exported here, so use egui_reactor::prelude::* is the only import a component file needs.

Re-exports§

pub use layout::Align;
pub use layout::AlignSelf;
pub use layout::ContainerStyle;
pub use layout::Direction;
pub use layout::Display;
pub use layout::Gap;
pub use layout::ItemStyle;
pub use layout::Justify;
pub use layout::Length;
pub use layout::PaintStyle;
pub use taffy;

Modules§

layout
Layout attributes: Length, ItemStyle and ContainerStyle.
paint
Paint attributes: PaintStyle, the look of a box.
prelude
Everything a component needs, in one use.

Macros§

rsx
Build a View from JSX-like syntax.

Structs§

Arity0
Marker: the handler ignores the payload (|| ..).
Arity1
Marker: the handler takes the payload (|payload| ..).
Collision
A hook id that was requested twice within one pass.
Cx
The context passed to components and hooks.
Dispatch
A Clone + Send sender into one use_reducer’s message queue.
Emitter
A child-side handle that fires one event kind.
FnCleanup
Marker for an effect body that returns a cleanup closure.
Handle
A Copy accessor to one hook slot.
NoCleanup
Marker for an effect body that returns no cleanup.
State
A guard over one use_state slot.
Store
Owns every hook’s state, keyed by [egui::Id].

Traits§

Handler
A callback prop that may or may not take the event payload.
IntoCleanup
What an effect body may return.
Props
Implemented by every #[component] props struct.
SpawnFuture
A future use_future and spawn can run.
View
Something that can draw itself into a Cx.

Functions§

props_builder
Get the props builder for a component function.
provide_context
Make value visible to use_context::<T> inside children.
spawn
Run a future to completion and throw its result away.
use_animate
egui’s animate_bool_with_time_and_easing behind a hook: 0 while on is false, 1 while it is true, and in between for time seconds after on flips, eased with cubic_out.
use_animate_with
use_animate with an easing of the caller’s choosing (egui::emath::easing).
use_context
Read the innermost Handle provided for T, if any.
use_effect
Run f on the first visit and whenever the hash of deps changes.
use_future
Run the future f builds, and report where it has got to.
use_handle
Like use_state, but returns a Copy Handle instead of a guard.
use_memo
Compute f on the first visit and whenever the hash of deps changes.
use_persisted
Hold T in the store and in the app’s storage, keyed by key.
use_reducer
Hold S in the store and fold queued messages into it with reducer.
use_state
Hold T in the store, initialising it on the first visit.
view
Wrap a closure as a View, fixing the closure’s argument type.

Type Aliases§

EventSink
The fused event closure a parent hands to a child, shared by every emitter.

Attribute Macros§

component
Turn a function into a egui-reactor component.
hook
Turn a function into a custom hook.