pub struct MapMessage<V, State, ParentAction, ChildAction, Context, F = fn(&mut State, ChildAction) -> ParentAction> { /* private fields */ }Expand description
View type for map_message and map_action. Most users will want to use map_action (the latter).
This view maps a child View<State,ChildAction,_> to View<State,ParentAction,_>, whilst allowing the kind of MessageResult to be changed.
Trait Implementations§
Source§impl<V, State, ParentAction, ChildAction, Context, F> Debug for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
V: Debug,
impl<V, State, ParentAction, ChildAction, Context, F> Debug for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
V: Debug,
Source§impl<V, State, ParentAction, ChildAction, Context, F> View<State, ParentAction, Context> for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
V: View<State, ChildAction, Context>,
State: 'static,
ParentAction: 'static,
ChildAction: 'static,
F: Fn(&mut State, MessageResult<ChildAction>) -> MessageResult<ParentAction> + 'static,
Context: ViewPathTracker + 'static,
impl<V, State, ParentAction, ChildAction, Context, F> View<State, ParentAction, Context> for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
V: View<State, ChildAction, Context>,
State: 'static,
ParentAction: 'static,
ChildAction: 'static,
F: Fn(&mut State, MessageResult<ChildAction>) -> MessageResult<ParentAction> + 'static,
Context: ViewPathTracker + 'static,
Source§type ViewState = <V as View<State, ChildAction, Context>>::ViewState
type ViewState = <V as View<State, ChildAction, Context>>::ViewState
State that is used over the lifetime of the retained representation of the view. Read more
Source§type Element = <V as View<State, ChildAction, Context>>::Element
type Element = <V as View<State, ChildAction, Context>>::Element
The element type which this view operates on.
Source§fn build(
&self,
ctx: &mut Context,
app_state: &mut State,
) -> (Self::Element, Self::ViewState)
fn build( &self, ctx: &mut Context, app_state: &mut State, ) -> (Self::Element, Self::ViewState)
Create the corresponding Element value.
Source§fn rebuild(
&self,
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<'_, Self::Element>,
app_state: &mut State,
)
fn rebuild( &self, prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, element: Mut<'_, Self::Element>, app_state: &mut State, )
Update
element based on the difference between self and prev.Source§fn teardown(
&self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<'_, Self::Element>,
)
fn teardown( &self, view_state: &mut Self::ViewState, ctx: &mut Context, element: Mut<'_, Self::Element>, )
Handle
element being removed from the tree. Read moreSource§fn message(
&self,
view_state: &mut Self::ViewState,
message: &mut MessageContext,
element: Mut<'_, Self::Element>,
app_state: &mut State,
) -> MessageResult<ParentAction>
fn message( &self, view_state: &mut Self::ViewState, message: &mut MessageContext, element: Mut<'_, Self::Element>, app_state: &mut State, ) -> MessageResult<ParentAction>
Route
message to id_path, if that is still a valid path.impl<V, State, ParentAction, ChildAction, F, Context> ViewMarker for MapMessage<V, State, ParentAction, ChildAction, Context, F>
Auto Trait Implementations§
impl<V, State, ParentAction, ChildAction, Context, F> Freeze for MapMessage<V, State, ParentAction, ChildAction, Context, F>
impl<V, State, ParentAction, ChildAction, Context, F> RefUnwindSafe for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
F: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, State, ParentAction, ChildAction, Context, F> Send for MapMessage<V, State, ParentAction, ChildAction, Context, F>
impl<V, State, ParentAction, ChildAction, Context, F> Sync for MapMessage<V, State, ParentAction, ChildAction, Context, F>
impl<V, State, ParentAction, ChildAction, Context, F> Unpin for MapMessage<V, State, ParentAction, ChildAction, Context, F>
impl<V, State, ParentAction, ChildAction, Context, F> UnwindSafe for MapMessage<V, State, ParentAction, ChildAction, Context, F>where
F: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<State, Action, Context, DynamicElement, V> AnyView<State, Action, Context, DynamicElement> for Vwhere
DynamicElement: AnyElement<<V as View<State, Action, Context>>::Element, Context>,
Context: ViewPathTracker,
V: View<State, Action, Context> + 'static,
<V as View<State, Action, Context>>::ViewState: 'static,
impl<State, Action, Context, DynamicElement, V> AnyView<State, Action, Context, DynamicElement> for Vwhere
DynamicElement: AnyElement<<V as View<State, Action, Context>>::Element, Context>,
Context: ViewPathTracker,
V: View<State, Action, Context> + 'static,
<V as View<State, Action, Context>>::ViewState: 'static,
Source§fn dyn_build(
&self,
ctx: &mut Context,
app_state: &mut State,
) -> (DynamicElement, AnyViewState)
fn dyn_build( &self, ctx: &mut Context, app_state: &mut State, ) -> (DynamicElement, AnyViewState)
Type erased
View::build.Source§fn dyn_rebuild(
&self,
dyn_state: &mut AnyViewState,
ctx: &mut Context,
prev: &dyn AnyView<State, Action, Context, DynamicElement>,
element: <DynamicElement as ViewElement>::Mut<'_>,
app_state: &mut State,
)
fn dyn_rebuild( &self, dyn_state: &mut AnyViewState, ctx: &mut Context, prev: &dyn AnyView<State, Action, Context, DynamicElement>, element: <DynamicElement as ViewElement>::Mut<'_>, app_state: &mut State, )
Type erased
View::rebuild.Source§fn dyn_teardown<'el>(
&self,
dyn_state: &mut AnyViewState,
ctx: &mut Context,
element: <DynamicElement as ViewElement>::Mut<'el>,
) -> <DynamicElement as ViewElement>::Mut<'el>
fn dyn_teardown<'el>( &self, dyn_state: &mut AnyViewState, ctx: &mut Context, element: <DynamicElement as ViewElement>::Mut<'el>, ) -> <DynamicElement as ViewElement>::Mut<'el>
Type erased
View::teardown. Read moreSource§fn dyn_message(
&self,
dyn_state: &mut AnyViewState,
message: &mut MessageContext,
element: <DynamicElement as ViewElement>::Mut<'_>,
app_state: &mut State,
) -> MessageResult<Action>
fn dyn_message( &self, dyn_state: &mut AnyViewState, message: &mut MessageContext, element: <DynamicElement as ViewElement>::Mut<'_>, app_state: &mut State, ) -> MessageResult<Action>
Type erased
View::message.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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Action, Context, V, Element> ViewSequence<State, Action, Context, Element> for Vwhere
Context: ViewPathTracker,
V: View<State, Action, Context> + ViewMarker,
Element: SuperElement<<V as View<State, Action, Context>>::Element, Context>,
<V as View<State, Action, Context>>::Element: ViewElement,
impl<State, Action, Context, V, Element> ViewSequence<State, Action, Context, Element> for Vwhere
Context: ViewPathTracker,
V: View<State, Action, Context> + ViewMarker,
Element: SuperElement<<V as View<State, Action, Context>>::Element, Context>,
<V as View<State, Action, Context>>::Element: ViewElement,
Source§const ELEMENTS_COUNT: Count = const ELEMENTS_COUNT: Count = Count::One;
const ELEMENTS_COUNT: Count = const ELEMENTS_COUNT: Count = Count::One;
The class of sequence this is, grouped based on how many elements it may contain.
This is useful for making bounds based on the expected number of child elements.
Source§type SeqState = <V as View<State, Action, Context>>::ViewState
type SeqState = <V as View<State, Action, Context>>::ViewState
The associated state of this sequence. The main purposes of this are: Read more
Source§fn seq_build(
&self,
ctx: &mut Context,
elements: &mut AppendVec<Element>,
app_state: &mut State,
) -> <V as ViewSequence<State, Action, Context, Element>>::SeqState
fn seq_build( &self, ctx: &mut Context, elements: &mut AppendVec<Element>, app_state: &mut State, ) -> <V as ViewSequence<State, Action, Context, Element>>::SeqState
Build the associated widgets into
elements and initialize all states.Source§fn seq_rebuild(
&self,
prev: &V,
seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState,
ctx: &mut Context,
elements: &mut impl ElementSplice<Element>,
app_state: &mut State,
)
fn seq_rebuild( &self, prev: &V, seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState, ctx: &mut Context, elements: &mut impl ElementSplice<Element>, app_state: &mut State, )
Update the associated widgets.
Source§fn seq_teardown(
&self,
seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState,
ctx: &mut Context,
elements: &mut impl ElementSplice<Element>,
)
fn seq_teardown( &self, seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState, ctx: &mut Context, elements: &mut impl ElementSplice<Element>, )
Update the associated widgets.
Source§fn seq_message(
&self,
seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState,
message: &mut MessageContext,
elements: &mut impl ElementSplice<Element>,
app_state: &mut State,
) -> MessageResult<Action>
fn seq_message( &self, seq_state: &mut <V as ViewSequence<State, Action, Context, Element>>::SeqState, message: &mut MessageContext, elements: &mut impl ElementSplice<Element>, app_state: &mut State, ) -> MessageResult<Action>
Propagate a message. Read more