Struct ::exo::Selection

Overview

A selection is a dropdown list where you can select a single

Methods

fn new() -> Selection

Creates a new empty Selection.

Creates a new Selection with the default languages prefilled.

fn get(self, elm: String) -> Option

Try to get a Language option from the Selection itself.

Please note, that options can be stored either in the Selection option or this Selection object itself. This call can only return a slection Language option from this Selection option itself.

Example:

let sel = exo::Selection::new();
assert_eq!(sel.get("test"), None);
sel.insert("test", exo::Language::new_en("Test"));
assert_eq!(sel.get("test"), Some(exo::Language::new_en("Test")));
fn insert(self, ident: String, lang: Language) -> Tuple

Inserts a new Option into the Selection. We recommond to only add dynamic options over this function. Options which should be always available should be added over the Selection Option.

Example:

let sel = exo::Selection::new();
sel.insert("test", exo::Language::new_en("Test"));
assert_eq!(sel.get("test"), Some(exo::Language::new_en("Test")));
fn remove(self, key: String) -> Tuple

Removes a Option from the Selection

Example:

let sel = exo::Selection::new();
sel.insert("key0", exo::Language::new());
assert_eq!(sel.keys(), ["key0"]);
sel.remove("key0");
assert_eq!(sel.keys(), []);

Returns all selected options from thie Selection.

fn set_selected(self, sel: Vec) -> Tuple

Sets the selected options for this Selection.

Returns only one selected option. If multiple options are selected this function returns one of them randomly.

Sets a single selected option for this Selection.

fn keys(self) -> Vec

Returns all keys for the different options of the selection

Example:

let sel = exo::Selection::new();
sel.insert("key0", exo::Language::new());
assert_eq!(sel.keys(), ["key0"]);

Return the Selection as String

Protocols

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.