[−][src]Struct cursive_core::event::EventTrigger
A trigger that only selects some types of events.
It is meant to be stored in views.
Implementations
impl EventTrigger
[src]
pub fn from_fn<F>(f: F) -> Self where
F: 'static + Fn(&Event) -> bool,
[src]
F: 'static + Fn(&Event) -> bool,
Create a new EventTrigger
using the given function as filter.
pub fn from_fn_and_tag<F, T>(f: F, tag: T) -> Self where
F: 'static + Fn(&Event) -> bool,
T: Any + Debug,
[src]
F: 'static + Fn(&Event) -> bool,
T: Any + Debug,
Create a new EventTrigger
.
pub fn has_tag<T: PartialEq + 'static>(&self, tag: &T) -> bool
[src]
Check if this trigger has the given tag.
Examples
use cursive_core::event::{Event, EventTrigger}; let event = Event::CtrlChar('c'); let trigger: EventTrigger = event.clone().into(); assert!(trigger.has_tag(&event), "Trigger does not recognize its own tag.");
pub fn apply(&self, event: &Event) -> bool
[src]
Checks if this trigger applies to the given Event
.
pub fn arrows() -> Self
[src]
Returns an EventTrigger
that only accepts arrow keys.
Only bare arrow keys without modifiers (Shift, Ctrl, Alt) will be accepted.
pub fn mouse() -> Self
[src]
Returns an EventTrigger
that only accepts mouse events.
pub fn any() -> Self
[src]
Returns an EventTrigger
that accepts any event.
pub fn none() -> Self
[src]
Returns an EventTrigger
that doesn't accept any event.
pub fn or<O>(self, other: O) -> Self where
O: Into<EventTrigger>,
[src]
O: Into<EventTrigger>,
Returns an EventTrigger
that applies if either self
or other
applies.
Trait Implementations
impl From<Event> for EventTrigger
[src]
impl<F> From<F> for EventTrigger where
F: 'static + Fn(&Event) -> bool,
[src]
F: 'static + Fn(&Event) -> bool,
impl From<Key> for EventTrigger
[src]
impl From<char> for EventTrigger
[src]
Auto Trait Implementations
impl !RefUnwindSafe for EventTrigger
impl !Send for EventTrigger
impl !Sync for EventTrigger
impl Unpin for EventTrigger
impl !UnwindSafe for EventTrigger
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,