Trait piston::TextEvent

source ·
pub trait TextEvent: Sized {
    // Required methods
    fn from_text(text: &str, old_event: &Self) -> Option<Self>;
    fn text<U, F>(&self, f: F) -> Option<U>
       where F: FnMut(&str) -> U;

    // Provided method
    fn text_args(&self) -> Option<String> { ... }
}
Expand description

When receiving text from user, such as typing a character.

Required Methods§

source

fn from_text(text: &str, old_event: &Self) -> Option<Self>

Creates a text event.

Preserves time stamp from original input event, if any.

source

fn text<U, F>(&self, f: F) -> Option<U>where F: FnMut(&str) -> U,

Calls closure if this is a text event.

Provided Methods§

source

fn text_args(&self) -> Option<String>

Returns text arguments.

Object Safety§

This trait is not object safe.

Implementors§