Trait druid::widget::ScopePolicy

source ·
pub trait ScopePolicy {
    type In: Data;
    type State: Data;
    type Transfer: ScopeTransfer<In = Self::In, State = Self::State>;

    // Required method
    fn create(self, inner: &Self::In) -> (Self::State, Self::Transfer);
}
Expand description

A policy that controls how a Scope will interact with its surrounding application data. Specifically, how to create an initial State from the input, and how to synchronise the two using a ScopeTransfer.

Required Associated Types§

source

type In: Data

The type of data that comes in from the surrounding application or scope.

source

type State: Data

The type of data that the Scope will maintain internally. This will usually be larger than the input data, and will embed the input data.

source

type Transfer: ScopeTransfer<In = Self::In, State = Self::State>

The type of transfer that will be used to synchronise internal and application state

Required Methods§

source

fn create(self, inner: &Self::In) -> (Self::State, Self::Transfer)

Make a new state and transfer from the input.

This consumes the policy, so non-cloneable items can make their way into the state this way.

Implementors§

source§

impl<F: FnOnce(Transfer::In) -> Transfer::State, Transfer: ScopeTransfer> ScopePolicy for DefaultScopePolicy<F, Transfer>

§

type In = <Transfer as ScopeTransfer>::In

§

type State = <Transfer as ScopeTransfer>::State

§

type Transfer = Transfer