Struct exonum_configuration::MaybeVote [] [src]

pub struct MaybeVote(_);

A functional equivalent to Option<Vote> used to store votes in the service schema.

Notes

The None variant of the type is represented by a Vote with all bytes set to zero.

Methods

impl MaybeVote
[src]

[src]

Creates a None variant.

[src]

Creates a Some variant.

Methods from Deref<Target = Option<Vote>>

1.0.0
[src]

Returns true if the option is a Some value.

Examples

let x: Option<u32> = Some(2);
assert_eq!(x.is_some(), true);

let x: Option<u32> = None;
assert_eq!(x.is_some(), false);

1.0.0
[src]

Returns true if the option is a None value.

Examples

let x: Option<u32> = Some(2);
assert_eq!(x.is_none(), false);

let x: Option<u32> = None;
assert_eq!(x.is_none(), true);

1.0.0
[src]

Converts from Option<T> to Option<&T>.

Examples

Convert an Option<String> into an Option<usize>, preserving the original. The map method takes the self argument by value, consuming the original, so this technique uses as_ref to first take an Option to a reference to the value inside the original.

let num_as_str: Option<String> = Some("10".to_string());
// First, cast `Option<String>` to `Option<&String>` with `as_ref`,
// then consume *that* with `map`, leaving `num_as_str` on the stack.
let num_as_int: Option<usize> = num_as_str.as_ref().map(|n| n.len());
println!("still can print num_as_str: {:?}", num_as_str);

Important traits for Iter<'a, A>
1.0.0
[src]

Returns an iterator over the possibly contained value.

Examples

let x = Some(4);
assert_eq!(x.iter().next(), Some(&4));

let x: Option<u32> = None;
assert_eq!(x.iter().next(), None);

Trait Implementations

impl Clone for MaybeVote
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for MaybeVote
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for MaybeVote
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl From<MaybeVote> for Option<Vote>
[src]

[src]

Performs the conversion.

impl Deref for MaybeVote
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl CryptoHash for MaybeVote
[src]

[src]

Returns a hash of the value. Read more

impl StorageValue for MaybeVote
[src]

Important traits for Vec<u8>
[src]

Serialize a value into a vector of bytes.

[src]

Deserialize a value from bytes.

Auto Trait Implementations

impl Send for MaybeVote

impl Sync for MaybeVote