Trait cursive::traits::Finder[][src]

pub trait Finder {
    pub fn call_on<V, F, R>(
        &mut self,
        sel: &Selector<'_>,
        callback: F
    ) -> Option<R>
    where
        F: FnOnce(&mut V) -> R,
        V: View
; pub fn call_on_name<V, F, R>(
        &mut self,
        name: &str,
        callback: F
    ) -> Option<R>
    where
        F: FnOnce(&mut V) -> R,
        V: View
, { ... }
pub fn call_on_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R>
    where
        F: FnOnce(&mut V) -> R,
        V: View
, { ... }
pub fn find_name<V>(
        &mut self,
        name: &str
    ) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>>
    where
        V: View
, { ... }
pub fn find_id<V>(
        &mut self,
        id: &str
    ) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>>
    where
        V: View
, { ... } }

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

pub fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R> where
    F: FnOnce(&mut V) -> R,
    V: View
[src]

Runs a callback on the view identified by sel.

If the view is found, return the result of callback.

If the view is not found, or if it is not of the asked type, it returns None.

Loading content...

Provided methods

pub fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R> where
    F: FnOnce(&mut V) -> R,
    V: View
[src]

Convenient method to use call_on with a view::Selector::Name.

pub fn call_on_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R> where
    F: FnOnce(&mut V) -> R,
    V: View
[src]

👎 Deprecated:

call_on_id is being renamed to call_on_name

Same as call_on_name.

pub fn find_name<V>(
    &mut self,
    name: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
    V: View
[src]

Convenient method to find a view wrapped in an NamedView.

pub fn find_id<V>(
    &mut self,
    id: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
    V: View
[src]

👎 Deprecated:

find_id is being renamed to find_name

Same as find_name.

Loading content...

Implementors

impl<T> Finder for T where
    T: View
[src]

Loading content...