Struct wallet_core::Options
pub struct Options {
options_range: Range<u8>,
}
Expand description
options for the vote
currently this is a 4bits structure, allowing up to 16 choices however we may allow more complex object to be set in
Fields§
§options_range: Range<u8>
Implementations§
§impl Options
impl Options
pub fn new_length(num_choices: u8) -> Result<Options, InvalidOptionsLength>
pub fn new_length(num_choices: u8) -> Result<Options, InvalidOptionsLength>
create a new Options
with the given number of available choices
available choices will go from 0
to num_choices
not included.
pub fn validate(&self, choice: Choice) -> bool
pub fn validate(&self, choice: Choice) -> bool
validate the given Choice
against the available Options
returns true
if the choice is valid, false
otherwise. By valid
it is meant as in the context of the available Options
. There is
obviously no wrong choices to make, only lessons to learn.
pub fn choice_range(&self) -> &Range<u8>
Trait Implementations§
impl Eq for Options
impl StructuralEq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more