pub trait DataAsyncReducer {
type Channel;
type Action;
// Required method
async fn async_reduce(
_radio: &mut Radio<Self, Self::Channel>,
_action: Self::Action,
) -> ChannelSelection<Self::Channel>
where Self::Channel: RadioChannel<Self>,
Self: Sized;
}radio only.Expand description
Define asynchronous actions for shared state, dispatched with RadioAsyncReducer.
Unlike DataReducer, this reducer receives a radio handle so state borrows
can be scoped around asynchronous work instead of held across await points.
Required Associated Types§
Required Methods§
Sourceasync fn async_reduce(
_radio: &mut Radio<Self, Self::Channel>,
_action: Self::Action,
) -> ChannelSelection<Self::Channel>
async fn async_reduce( _radio: &mut Radio<Self, Self::Channel>, _action: Self::Action, ) -> ChannelSelection<Self::Channel>
Process an action asynchronously and select the final notification channel.
Use Radio::write_silently for mutations that should only notify when
RadioAsyncReducer::async_apply processes the returned selection.
Ordinary writes still send their own notifications. Release all read and
write guards before awaiting so other tasks can access the state.
Returning ChannelSelection::Silence skips the final notification but
does not undo state changes or notifications already sent by writes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".