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.2"
For embedded systems (no_std):
[]
= { = "0.4.2", = ["no_std"] }
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
Examples
Working examples demonstrating oxide-mvu in various environments:
- cortex-m-single-core - Complete
no_stdembedded example running on nRF52840 (Cortex-M4F) with Embassy async runtime, emulated via Renode.
See the examples directory for more.
Testing
The MVU pattern makes applications easy to test. State transitions are pure functions:
For integration testing, use the testing feature:
[]
= { = "0.4.2", = ["testing"] }
This provides:
TestMvuRuntime- Runtime with manual event processing controlTestRenderer- Renderer that captures Props for assertionscreate_test_spawner()- Test-friendly task spawner
use ;
See the tests directory for more examples.
Learn More
- API Documentation - Complete API reference with examples
- Examples - Working examples in various environments
- Tests - Tests demonstrating common patterns
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)