Struct newt::callbacks::EntryFilter
source · [−]pub struct EntryFilter<'a, FN: 'a, T: 'a> where
FN: FnMut(&Entry, Option<&T>, char, i32) -> char, { /* private fields */ }
Expand description
A callback used to filter text entered into an Entry
component.
The function or closure associated with the callback should be defined as follows:
fn(entry: &Entry, data: Option<&T>, ch: char, cursor_pos: i32) -> char
entry
- TheEntry
being filtered.data
- The optional user data provided.ch
- The character entered into theEntry
.cursor_pos
- The current cursor position in theEntry
.
The function should return the character to be entered into the
Entry
field or ‘\0’ to ignore the entered character.
See the example under Entry.
Implementations
sourceimpl<'a, FN: 'a, T: 'a> EntryFilter<'a, FN, T> where
FN: FnMut(&Entry, Option<&T>, char, i32) -> char,
impl<'a, FN: 'a, T: 'a> EntryFilter<'a, FN, T> where
FN: FnMut(&Entry, Option<&T>, char, i32) -> char,
sourcepub fn new(
entry: &'a Entry,
data: Option<T>,
function: FN
) -> Box<EntryFilter<'a, FN, T>>
pub fn new(
entry: &'a Entry,
data: Option<T>,
function: FN
) -> Box<EntryFilter<'a, FN, T>>
Create a new EntryFilter
.
Creates a new EntryFilter
associated with the Entry
entry
.
The function function
will be called for each character entered.
entry
- TheEntry
to associate with the callback.data
- The optonal user data to pass to the function.function
- The function or closure to be called when a character is entered.
Auto Trait Implementations
impl<'a, FN, T> !RefUnwindSafe for EntryFilter<'a, FN, T>
impl<'a, FN, T> !Send for EntryFilter<'a, FN, T>
impl<'a, FN, T> !Sync for EntryFilter<'a, FN, T>
impl<'a, FN, T> Unpin for EntryFilter<'a, FN, T> where
FN: Unpin,
T: Unpin,
impl<'a, FN, T> !UnwindSafe for EntryFilter<'a, FN, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more