pub struct AppendReducer<S: StateSchema, T: Clone + Send + Sync> {
pub field_accessor: fn(&S) -> &[T],
pub field_mutator: fn(&mut S, Vec<T>),
}Expand description
Append reducer for vector fields (like add_messages pattern)
This reducer appends new items to vector fields in the state. Useful for message history, steps history, etc.
Fields§
§field_accessor: fn(&S) -> &[T]Function that reads the vector field from a state.
field_mutator: fn(&mut S, Vec<T>)Function that writes the merged vector back into a state.
Trait Implementations§
Auto Trait Implementations§
impl<S, T> Freeze for AppendReducer<S, T>
impl<S, T> RefUnwindSafe for AppendReducer<S, T>
impl<S, T> Send for AppendReducer<S, T>
impl<S, T> Sync for AppendReducer<S, T>
impl<S, T> Unpin for AppendReducer<S, T>
impl<S, T> UnsafeUnpin for AppendReducer<S, T>
impl<S, T> UnwindSafe for AppendReducer<S, T>
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