Trait unsegen::input::Behavior [−][src]
Expand description
Something that reacts to input and possibly consumes it.
An inplementor is free to check the Input
for arbitrary criteria and return the input if not
consumed. Note that the implementor should not change the input event in that case.
If the implementor somehow reacts to the input, it is generally a good idea to “consume” the
value by returning None. This makes sure that subsequent Behavior
s will not act.
Another thing of note is that a Behavior is generally constructed on the fly and consumed in
the input
function!
For specialised behavior that does not fit into the often used abstractions defined in this
module (Scrollable
, Writable
, Navigatable
, …) the easiest way to construct a behavior
is either using a FnOnce(Input) -> Option<Input>
where the implementor has to decide whether
the input matches the desired criteria or using a pair (ToEvent, FnOnce())
where the function
is only iff the Input
to be processed matches the provided Event
-like thing.
Required methods
Implementations on Foreign Types
Implementors
impl<'a, 'b, 'c, 'd: 'a, C: ContainerProvider + 'a + 'b> Behavior for ActiveContainerBehavior<'a, 'b, 'c, 'd, C>
[src]
impl<'a, 'b, 'c, 'd: 'a, C: ContainerProvider + 'a + 'b> Behavior for ActiveContainerBehavior<'a, 'b, 'c, 'd, C>
[src]Pass input on to the currently active container.
impl<'a, E: Editable> Behavior for EditBehavior<'a, E>
[src]
impl<'a, E: Editable> Behavior for EditBehavior<'a, E>
[src]impl<'a, N: Navigatable + 'a> Behavior for NavigateBehavior<'a, N>
[src]
impl<'a, N: Navigatable + 'a> Behavior for NavigateBehavior<'a, N>
[src]impl<'a, S: Scrollable> Behavior for ScrollBehavior<'a, S>
[src]
impl<'a, S: Scrollable> Behavior for ScrollBehavior<'a, S>
[src]impl<'a, W: Writable + 'a> Behavior for WriteBehavior<'a, W>
[src]
impl<'a, W: Writable + 'a> Behavior for WriteBehavior<'a, W>
[src]