[−][src]Trait unsegen::input::Behavior
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
Loading content...Implementations on Foreign Types
impl<E: ToEvent, F: FnOnce()> Behavior for (E, F)
[src]
impl<E: ToEvent + Clone, F: FnOnce(), '_> Behavior for (&'_ [E], F)
[src]
Loading content...Implementors
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.