[][src]Struct unsegen::base::style::TextFormatModifier

pub struct TextFormatModifier {
    pub bold: BoolModifyMode,
    pub italic: BoolModifyMode,
    pub invert: BoolModifyMode,
    pub underline: BoolModifyMode,
    // some fields omitted
}

Specifies how to modify a text format value.

Fields

bold: BoolModifyModeitalic: BoolModifyModeinvert: BoolModifyModeunderline: BoolModifyMode

Implementations

impl TextFormatModifier[src]

pub fn new() -> Self[src]

Construct a new (not actually) modifier, that leaves all properties unchanged.

pub fn bold<M: Into<BoolModifyMode>>(self, val: M) -> Self[src]

Set the bold property of the TextFormatModifier

Examples:

use unsegen::base::{TextFormatModifier, BoolModifyMode};

assert_eq!(TextFormatModifier::new().bold(BoolModifyMode::Toggle).bold,
BoolModifyMode::Toggle);

pub fn italic<M: Into<BoolModifyMode>>(self, val: M) -> Self[src]

Set the italic property of the TextFormatModifier

Examples:

use unsegen::base::{TextFormatModifier, BoolModifyMode};

assert_eq!(TextFormatModifier::new().italic(BoolModifyMode::True).italic,
BoolModifyMode::True);

pub fn invert<M: Into<BoolModifyMode>>(self, val: M) -> Self[src]

Set the invert property of the TextFormatModifier

Examples:

use unsegen::base::{TextFormatModifier, BoolModifyMode};

assert_eq!(TextFormatModifier::new().invert(BoolModifyMode::False).invert,
BoolModifyMode::False);

pub fn underline<M: Into<BoolModifyMode>>(self, val: M) -> Self[src]

Set underline invert property of the TextFormatModifier

Examples:

use unsegen::base::{TextFormatModifier, BoolModifyMode};

assert_eq!(TextFormatModifier::new().underline(BoolModifyMode::LeaveUnchanged).underline,
BoolModifyMode::LeaveUnchanged);

pub fn on_top_of(self, other: TextFormatModifier) -> 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 some TextFormat.

Examples:

use unsegen::base::{TextFormatModifier, TextFormat, BoolModifyMode};

let mut f1 = TextFormat::default();
let mut f2 = f1;

let m1 =
TextFormatModifier::new().italic(BoolModifyMode::Toggle).bold(true).underline(false);
let m2 = TextFormatModifier::new().italic(true).bold(false);

m1.on_top_of(m2).modify(&mut f1);

m2.modify(&mut f2);
m1.modify(&mut f2);

assert_eq!(f1, f2);

pub fn modify(self, format: &mut TextFormat)[src]

Modify the passed textformat according to the modification rules of self.

Trait Implementations

impl Clone for TextFormatModifier[src]

impl Copy for TextFormatModifier[src]

impl Debug for TextFormatModifier[src]

impl Default for TextFormatModifier[src]

impl Eq for TextFormatModifier[src]

impl PartialEq<TextFormatModifier> for TextFormatModifier[src]

impl StructuralEq for TextFormatModifier[src]

impl StructuralPartialEq for TextFormatModifier[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.