Skip to main content

Crate rust_elm

Crate rust_elm 

Source
Expand description

§rust-elm

A Rust port of The Elm Architecture

  • Pure descriptions: Cmd, Effect, and Sub are data — interpretation lives in Runtime (requires runtime feature).
  • Zero-cost updates: update uses fn pointers; no Box<dyn Fn> on hot paths.
  • Composition: Slot, optics, Reducer / CombineReducers.

Re-exports§

pub use batch::batch;
pub use bus::Bus;
pub use bus::BusSender;
pub use cmd::Cmd;
pub use component::lift;
pub use component::Slot;
pub use effect::Effect;
pub use effect::EffectId;
pub use effect::EnvTaskFn;
pub use effect::RunSender;
pub use effect::TaskFn;
pub use env::defer_batch;
pub use env::Environment;
pub use env::FakeClock;
pub use env::MockHttp;
pub use error::EffectError;
pub use interp::flatten_effects;
pub use interp::normalize;
pub use interp::InterpretCtx;
pub use optics::CasePath;
pub use optics::Casepath;
pub use program::Program;
pub use program::ReducerProgram;
pub use reduce_panic::catch_reduce;
pub use reduce_panic::catch_reduce_panic;
pub use reduce_panic::ReducePanic;
pub use reducer::coerce_fn;
pub use reducer::CatchReducer;
pub use reducer::CombineReducers;
pub use reducer::Reduce;
pub use reducer::Reducer;
pub use reducer::RollbackCatchReducer;
pub use replay::ReplayHarness;
pub use replay::ReplayLog;
pub use runtime::Runtime;
pub use runtime::RuntimeConfig;
pub use scope::lift_cmd;
pub use scope::lift_cmd_with_id;
pub use scope::ForEachReducer;
pub use scope::IfCaseLetReducer;
pub use scope::IfLetReducer;
pub use scope::OptionalReducer;
pub use scope::ScopeReducer;
pub use shared::InMemoryStorage;
pub use shared::Shared;
pub use shared::SharedSubscriber;
pub use shared::Storage;
pub use shared::StorageError;
pub use store::ScopedStore;
pub use store::StateSubscriber;
pub use store::Store;
pub use store::StoreTask;
pub use store::StoreTaskError;
pub use sub::Sub;
pub use test_runtime::TestRuntime;
pub use test_store::ExhaustiveTestStore;
pub use test_store::TestStoreError;
pub use test_support::allow_state_clones;
pub use test_support::on_state_clone;
pub use test_support::replay_snapshot;
pub use test_support::shared_get;
pub use test_support::shared_with_mut;
pub use test_support::scoped_child_state;
pub use test_support::scoped_subscribe_state;
pub use test_support::scoped_subscriber_next;
pub use test_support::store_state;
pub use test_support::subscribe_state;
pub use test_support::subscriber_wait_next;
pub use rust_dependencies as dependencies;
pub use rust_key_paths;
pub use key_paths_core;

Modules§

batch
bus
cmd
component
effect
env
error
interp
keypath
Re-export keypath types for state/action focusing (see optics).
macros
Declarative macros for update dispatch and test message enums.
optics
Enum casepath (prism) helpers for scoped reducers and stores.
program
Elm Program — init, update, subscriptions (fn-pointer path).
reduce_panic
Panic guards for reducers — runtime-agnostic (no Tokio).
reducer
replay
runtime
scope
shared
store
sub
subscription
Subscription interpreter — starts/stops long-lived Tokio sources declared by Sub.
test_runtime
test_store
test_support
Test helpers for asserting store/reducer paths do not clone feature state.

Macros§

arbitrary_msg
Generate a trivial action for property tests.
assert_effect
Assert that the last command contains an effect matching a predicate.
panic_on_state_clone
Define a reducer/store state struct whose Clone panics unless budget is available.
reducers
Build a [CombineReducers] tuple from reducer fn pointers.
total_update
Match all variants of an action enum in update (exhaustive dispatch helper).

Structs§

ClockDep
ClockKey
DependencyError
Error when a required dependency is absent.
DependencyValues
Typed dependency bag keyed by TypeId (UDF DependencyValues).
EnumKp
EnumKp - A keypath for enum variants that supports both extraction and embedding Leverages the existing Kp architecture where optionals are built-in via Option
IdentifiedVec
Ordered collection with O(1) id lookup (UDF IdentifiedArray parity).
Kp
Kp — typed keypath with getter/setter closures. See also AKp for type-erased keypaths.
LiveRng
Production RNG backed by a splitmix-seeded xorshift64 state.
LiveUuidGen
Production UUID stand-in mixing wall time, pid, and a monotonic counter.
NowDep
NowKey
RealClock
RngDep
RngKey
SeededRng
SeededUuidGen
Deterministic UUID stand-in for tests — not cryptographically random.
TestClock
Deterministic monotonic clock for tests.
TestNow
UuidDep
UuidKey

Traits§

Clock
DepRng
DependencyKey
Register a dependency value under its key type (UDF DependencyKey).
Identifiable
Elements stored in IdentifiedVec must expose a stable identifier.
Now
UuidGen

Functions§

enum_err
Extract from Result<T, E> - Err variant
enum_ok
Extract from Result<T, E> - Ok variant
enum_some
Extract from Option - Some variant
enum_variant
Create an enum keypath with both extraction and embedding for a specific variant
variant_of
Create an enum keypath for a specific variant with type inference

Type Aliases§

EnumKpType
EnumValueKpType
Casepath whose payload is extracted by value (cloned) rather than by reference.