[][src]Struct meli::components::utilities::Selector

pub struct Selector<T: 'static + PartialEq + Debug + Clone + Sync + Send, F: 'static + Sync + Send> {
    single_only: bool,
    entries: Vec<(T, bool)>,
    pub content: CellBuffer,
    theme_default: ThemeAttribute,
    cursor: SelectorCursor,
    vertical_alignment: Alignment,
    horizontal_alignment: Alignment,
    title: String,
    done: bool,
    done_fn: F,
    dirty: bool,
    id: ComponentId,
}

Shows a little window with options for user to select.

Instantiate with Selector::new(). Set single_only to true if user should only choose one of the options. After passing input events to this component, check Selector::is_done to see if the user has finalised their choices. Collect the choices by consuming the Selector with Selector::collect()

Fields

single_only: bool

allow only one selection

entries: Vec<(T, bool)>content: CellBuffertheme_default: ThemeAttributecursor: SelectorCursorvertical_alignment: Alignmenthorizontal_alignment: Alignmenttitle: Stringdone: bool

If true, user has finished their selection

done_fn: Fdirty: boolid: ComponentId

Implementations

impl<T: PartialEq + Debug + Clone + Sync + Send, F: 'static + Sync + Send> Selector<T, F>[src]

pub fn new(
    title: &str,
    entries: Vec<(T, String)>,
    single_only: bool,
    done_fn: F,
    context: &Context
) -> Selector<T, F>
[src]

pub fn is_done(&self) -> bool[src]

pub fn collect(self) -> Vec<T>[src]

fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context)[src]

impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Selector<T, Option<Box<dyn FnOnce(Uuid, &[T]) + 'static + Sync + Send>>>[src]

fn done(&mut self) -> Option<UIEvent>[src]

impl Selector<bool, Option<Box<dyn FnOnce(Uuid, bool) + 'static + Sync + Send>>>[src]

fn done(&mut self) -> Option<UIEvent>[src]

Trait Implementations

impl<T: 'static + PartialEq + Debug + Clone + Sync + Send, F: 'static + Sync + Send> Debug for Selector<T, F>[src]

impl<T: 'static + PartialEq + Debug + Clone + Sync + Send, F: 'static + Sync + Send> Display for Selector<T, F>[src]

impl<T: 'static + PartialEq + Debug + Clone + Sync + Send, F: 'static + Sync + Send> PartialEq<Selector<T, F>> for Selector<T, F>[src]

Auto Trait Implementations

impl<T, F> RefUnwindSafe for Selector<T, F> where
    F: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, F> Send for Selector<T, F>

impl<T, F> Sync for Selector<T, F>

impl<T, F> Unpin for Selector<T, F> where
    F: Unpin,
    T: Unpin

impl<T, F> UnwindSafe for Selector<T, F> where
    F: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

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

impl<T> ToString for T where
    T: Display + ?Sized
[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<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]