Trait carbide_core::state::state_sync::StateSync[][src]

pub trait StateSync<S>: CommonWidget<S> where
    S: GlobalState
{ fn insert_local_state(&self, env: &mut Environment<S>);
fn update_all_widget_state(
        &mut self,
        env: &Environment<S>,
        global_state: &S
    );
fn update_local_widget_state(&mut self, env: &Environment<S>);
fn sync_state(&mut self, env: &mut Environment<S>, global_state: &S); fn default_sync_state(&mut self, env: &mut Environment<S>, global_state: &S) { ... } }

Required methods

fn insert_local_state(&self, env: &mut Environment<S>)[src]

Insert local state from the widget into the environment. Return true if any of the keys from the widget was already in the local state.

fn update_all_widget_state(&mut self, env: &Environment<S>, global_state: &S)[src]

Update the state for this widget. Update both local, global and environment state

fn update_local_widget_state(&mut self, env: &Environment<S>)[src]

Update only the local state for the widget

fn sync_state(&mut self, env: &mut Environment<S>, global_state: &S)[src]

This should be implemented to synchronize both global and local state. A general implementation should:

  • Update the widget state, both global and local
  • Insert its own local state into the environment
  • Iterate though its children and sync_state on each You can in most cases use default_sync_state
Loading content...

Provided methods

fn default_sync_state(&mut self, env: &mut Environment<S>, global_state: &S)[src]

Loading content...

Implementations on Foreign Types

impl<S: GlobalState> StateSync<S> for Box<dyn Widget<S>>[src]

Loading content...

Implementors

impl<GS: GlobalState> StateSync<GS> for SyncTest<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Border<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Canvas[src]

impl<GS: GlobalState> StateSync<GS> for Clip<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Frame<GS>[src]

impl<GS: GlobalState> StateSync<GS> for HStack<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Hidden<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Image[src]

impl<GS: GlobalState> StateSync<GS> for Offset<GS>[src]

impl<GS: GlobalState> StateSync<GS> for OverlaidLayer<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Padding<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Scroll<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Rectangle<GS>[src]

impl<GS: GlobalState> StateSync<GS> for RoundedRectangle<GS>[src]

impl<GS: GlobalState> StateSync<GS> for Spacer[src]

impl<GS: GlobalState> StateSync<GS> for Text<GS>[src]

impl<GS: GlobalState> StateSync<GS> for VStack<GS>[src]

impl<GS: GlobalState> StateSync<GS> for ZStack<GS>[src]

impl<S, GS: GlobalState> StateSync<GS> for Oval<S, GS> where
    S: 'static + Clone
[src]

impl<S: GlobalState, T> StateSync<S> for T where
    T: NoLocalStateSync + CommonWidget<S>, 
[src]

impl<T, GS: GlobalState> StateSync<GS> for ForEach<GS, T> where
    T: ForEachDelegate + 'static, 
[src]

Loading content...