Trait cursive::view::Finder
[−]
[src]
pub trait Finder { fn call_on<V, F, R>(&mut self, sel: &Selector, callback: F) -> Option<R>
where
V: View + Any,
F: FnOnce(&mut V) -> R; fn find_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R>
where
V: View + Any,
F: FnOnce(&mut V) -> R, { ... } }
Provides call_on<V: View>
to views.
This trait is mostly a wrapper around View::call_on_any
.
It provides a nicer interface to find a view when you know its type.
Required Methods
fn call_on<V, F, R>(&mut self, sel: &Selector, callback: F) -> Option<R> where
V: View + Any,
F: FnOnce(&mut V) -> R,
V: View + Any,
F: FnOnce(&mut V) -> R,
Tries to find the view pointed to by the given selector.
If the view is not found, or if it is not of the asked type, it returns None.
Provided Methods
fn find_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R> where
V: View + Any,
F: FnOnce(&mut V) -> R,
V: View + Any,
F: FnOnce(&mut V) -> R,
Convenient method to use call_on
with a view::Selector::Id
.
Implementors
impl<T: View> Finder for T