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.

§Source layout

DirectoryRole
core/Cmd, Effect, Sub, Program, bus — pure data
compose/Reducer, ScopeReducer, safe_reducer, optics
infra/Environment, Shared, replay
runtime/Store, Tokio interpreter, subscriptions (runtime feature)
testing/TestRuntime, ExhaustiveTestStore, macros

Re-exports§

pub use core::batch;
pub use core::bus;
pub use core::cmd;
pub use core::effect;
pub use core::error;
pub use core::interp;
pub use core::program;
pub use core::sub;
pub use compose::component;
pub use compose::optics;
pub use compose::reducer;
pub use compose::safe_reducer;
pub use compose::scope;
pub use infra::env;
pub use infra::replay;
pub use infra::shared;
pub use testing::macros;
pub use testing::test_runtime;
pub use testing::test_support;
pub use testing::test_store;
pub use runtime::store;
pub use runtime::subscription;
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 safe_reducer::safe_reduce_rollback;
pub use safe_reducer::safe_reduce_update;
pub use safe_reducer::SafeReduceError;
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 runtime::RuntimeError;
pub use runtime::RwRuntime;
pub use runtime::TeaRuntime;
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::ChangeSet;
pub use store::ChangeSubscriber;
pub use store::ScopedChangeSubscriber;
pub use store::ScopedStore;
pub use store::StateSubscriber;
pub use store::Store;
pub use store::StoreTask;
pub use store::StoreTaskError;
pub use runtime::rw_store::ReadStore;
pub use runtime::rw_store::RwChangeSubscriber;
pub use runtime::rw_store::RwStateSubscriber;
pub use runtime::rw_store::RwStore;
pub use runtime::rw_store::ScopedRwStore;
pub use runtime::tea_store::ScopedTeaStore;
pub use runtime::tea_store::ScopedTeaStateSubscriber;
pub use runtime::tea_store::TeaChangeSubscriber;
pub use runtime::tea_store::TeaStateSubscriber;
pub use runtime::tea_store::TeaStore;
pub use runtime::tea_store::TeaStoreError;
pub use runtime::tea_store::TeaViewStore;
pub use runtime::binding::ComposedBinding;
pub use runtime::binding::ProjectedBinding;
pub use runtime::binding::ReadProjectedBinding;
pub use runtime::binding::ReadStateBinding;
pub use runtime::binding::RwProjectedBinding;
pub use runtime::binding::RwStateBinding;
pub use runtime::binding::StateBinding;
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::start_reducer_runtime;
pub use test_support::start_runtime;
pub use test_support::start_rw_reducer_runtime;
pub use test_support::start_tea_reducer_runtime;
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§

compose
Reducer composition, scoping, and action/state optics.
core
Pure UDF descriptions — no Tokio required.
infra
Environment, shared state, and replay utilities.
keypath
Re-export keypath types for state/action focusing (see optics).
runtime
Tokio-backed live runtime: bus, store, effect interpreter, subscriptions.
testing
Test harnesses and macros.

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.