[][src]Struct newt::callbacks::EntryFilter

pub struct EntryFilter<'a, FN: 'a, T: 'a> where
    FN: FnMut(&Entry, Option<&T>, char, i32) -> char
{ /* fields omitted */ }

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 - The Entry being filtered.
  • data - The optional user data provided.
  • ch - The character entered into the Entry.
  • cursor_pos - The current cursor position in the Entry.

The function should return the character to be entered into the Entry field or '\0' to ignore the entered character.

Methods

impl<'a, FN: 'a, T: 'a> EntryFilter<'a, FN, T> where
    FN: FnMut(&Entry, Option<&T>, char, i32) -> char
[src]

pub fn new(
    entry: &'a Entry,
    function: FN,
    data: Option<T>
) -> Box<EntryFilter<'a, FN, T>>
[src]

Create a new EntryFilter.

Creates a new EntryFilter associated with the Entry entry. The function function will be called for each character entered.

  • entry - The Entry to associate with the callback.
  • function - The function or closure to be called when a character is entered.
  • data - The optonal user data to pass to the function.

pub fn add_entry(&mut self, entry: &'a Entry, data: Option<T>)[src]

Associate another Entry with the EntryFilter.

  • entry - The Entry to associate with the callback.
  • data - The optonal user data to pass to the function.

Auto Trait Implementations

impl<'a, FN, T> !Send for EntryFilter<'a, FN, T>

impl<'a, FN, T> !Sync for EntryFilter<'a, FN, T>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]