pub struct MvuRuntime<Event: Send, Model: Clone + Send, Props> { /* private fields */ }Expand description
The MVU runtime that orchestrates the event loop.
This is the core of the framework. It:
- Initializes the Model and initial Effects via
MvuLogic::init - Processes events through
MvuLogic::update - Reduces the Model to Props via
MvuLogic::view - Delivers Props to the
Rendererfor rendering
The runtime creates a single Emitter that automatically processes events
when Emitter::emit is called, regardless of which thread it’s called from.
Events are processed synchronously in a thread-safe manner.
For testing with manual control, use [TestMvuRuntime] with a [crate::TestRenderer].
See the crate-level documentation for a complete example.
Implementations§
Source§impl<Event: Send + 'static, Model: Clone + Send + 'static, Props: 'static> MvuRuntime<Event, Model, Props>
impl<Event: Send + 'static, Model: Clone + Send + 'static, Props: 'static> MvuRuntime<Event, Model, Props>
Sourcepub fn new(
init_model: Model,
logic: Box<dyn MvuLogic<Event, Model, Props> + Send>,
renderer: Box<dyn Renderer<Props> + Send>,
spawner: Spawner,
) -> Self
pub fn new( init_model: Model, logic: Box<dyn MvuLogic<Event, Model, Props> + Send>, renderer: Box<dyn Renderer<Props> + Send>, spawner: Spawner, ) -> Self
Create a new runtime.
The runtime will not be started until MvuRuntime::run is called.
§Arguments
init_model- The initial statelogic- Application logic implementing MvuLogicrenderer- Platform rendering implementation for rendering Propsspawner- Function to spawn async effects on your chosen runtime
Auto Trait Implementations§
impl<Event, Model, Props> Freeze for MvuRuntime<Event, Model, Props>
impl<Event, Model, Props> !RefUnwindSafe for MvuRuntime<Event, Model, Props>
impl<Event, Model, Props> Send for MvuRuntime<Event, Model, Props>
impl<Event, Model, Props> !Sync for MvuRuntime<Event, Model, Props>
impl<Event, Model, Props> Unpin for MvuRuntime<Event, Model, Props>
impl<Event, Model, Props> !UnwindSafe for MvuRuntime<Event, Model, Props>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more