oxide-mvu
A lightweight Model-View-Update (MVU) runtime for Rust with no_std support.
Note: This framework is under active development. APIs should not be considered stable.
What is MVU?
The Model-View-Update pattern (also known as the Elm Architecture) structures applications as a pure functional loop:
- Model: Immutable state representing your entire application
- Update: Pure function transforming
(Event, Model) → (Model, Effect) - View: Pure function deriving renderable Props from the Model
This architecture eliminates implicit state mutation, making your application predictable, debuggable, and testable.
Why oxide-mvu?
- Pure functional state management - All state transitions are explicit and testable
- Unidirectional data flow - Easy to reason about and debug
- Lock-free concurrency - Events from any thread without mutex overhead
- Async runtime agnostic - Works with tokio, async-std, smol, or custom executors
- Built-in testing utilities - Comprehensive test helpers included
no_stdsupport - Suitable for embedded systems (requiresalloc)
Quick Start
Installation
[]
= "0.4.1"
Documentation
For comprehensive guides, architecture details, and advanced usage, see the API Documentation.
use ;
// 1. Model the system, its behavior, and the renderable
// projection (Props) including any controls.
// 2. Implement application logic
;
// 3. Implement a renderer to display Props.
;
// 4. Run the application
async
Platform Support
Standard Environments
By default, oxide-mvu works with the standard library:
[]
= "0.4.1"
no_std Environments
For embedded systems without the standard library:
[]
= { = "0.4.1", = ["no_std"] }
The runtime uses lock-free concurrency and bounded channels, making it suitable for resource-constrained systems (including single-core). Requires an allocator (alloc crate).
Testing
oxide-mvu provides specialized testing utilities for integration testing your MVU applications.
Enabling Testing Utilities
To access the testing helpers in your project, enable the testing feature:
[]
= { = "0.4.1", = ["testing"] }
This gives you access to:
TestMvuRuntime- Runtime with manual event processing controlTestMvuDriver- Driver for manually processing events in testsTestRenderer- Renderer that captures Props for assertions
Unit Testing
State transitions are pure functions, making them easy to unit test:
Integration Testing
Use TestMvuRuntime::builder to construct and manually drive the runtime deterministically.
To verify Props, keep a reference to the TestRenderer.
use ;
See the tests/integration directory for more examples.
Learn More
- API Documentation - Complete API reference with examples
- Tests - Tests demonstrating common patterns
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)