[][src]Enum unsegen::base::style::BoolModifyMode

pub enum BoolModifyMode {
    True,
    False,
    Toggle,
    LeaveUnchanged,
}

Specifies how to modify a bool value.

(In essence, specifies one of all possible unary boolean functions.)

Variants

True
False
Toggle
LeaveUnchanged

Implementations

impl BoolModifyMode[src]

pub fn on_top_of(self, other: Self) -> Self[src]

Combine the current value with that of the argument so that the application of the returned value is always equivalent to first applying other and then applying self to a bool.

Examples:

use unsegen::base::BoolModifyMode;

assert_eq!(BoolModifyMode::LeaveUnchanged.on_top_of(BoolModifyMode::False),
            BoolModifyMode::False);
assert_eq!(BoolModifyMode::True.on_top_of(BoolModifyMode::Toggle /*or any other value*/),
            BoolModifyMode::True);
assert_eq!(BoolModifyMode::Toggle.on_top_of(BoolModifyMode::Toggle),
            BoolModifyMode::LeaveUnchanged);

pub fn modify(self, target: &mut bool)[src]

Modify the target bool according to the modification mode.

Examples:

use unsegen::base::BoolModifyMode;

let mut b = true;
BoolModifyMode::False.modify(&mut b);
assert_eq!(b, false);

let mut b = false;
BoolModifyMode::LeaveUnchanged.modify(&mut b);
assert_eq!(b, false);

let mut b = false;
BoolModifyMode::Toggle.modify(&mut b);
assert_eq!(b, true);

Trait Implementations

impl Clone for BoolModifyMode[src]

impl Copy for BoolModifyMode[src]

impl Debug for BoolModifyMode[src]

impl Eq for BoolModifyMode[src]

impl From<bool> for BoolModifyMode[src]

impl PartialEq<BoolModifyMode> for BoolModifyMode[src]

impl StructuralEq for BoolModifyMode[src]

impl StructuralPartialEq for BoolModifyMode[src]

Auto Trait Implementations

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.