[][src]Struct sunrise_kernel::devices::rs232::SerialAttributes

pub struct SerialAttributes {
    fg: SerialColor,
    bg: SerialColor,
}

A foreground and a background combination

Fields

fg: SerialColor

foreground color

bg: SerialColor

background color

Implementations

impl SerialAttributes[src]

pub fn fg(fg: SerialColor) -> SerialAttributes[src]

Creates a color attribute with fg foreground and default background.

pub fn fg_bg(fg: SerialColor, bg: SerialColor) -> SerialAttributes[src]

Creates a color attribute with fg foreground and bg background.

pub fn default() -> SerialAttributes[src]

Creates a color attribute with default foreground and default background.

Trait Implementations

impl Clone for SerialAttributes[src]

impl Copy for SerialAttributes[src]

impl Debug for SerialAttributes[src]

impl Display for SerialAttributes[src]

To log something with color attributes do something like this:

use ::device::rs232::{SerialLogger, SerialAttributes, SerialColor};
use ::core::fmt::Write;

write!(SerialLogger, "Hello {}World{}!",
    SerialAttributes::fg(SerialColor::Green), // a green foreground with default background.
    SerialAttributes::default() // don't forget to set back to default attributes at the end.
);

Auto Trait Implementations

impl RefUnwindSafe for SerialAttributes

impl Send for SerialAttributes

impl Sync for SerialAttributes

impl Unpin for SerialAttributes

impl UnwindSafe for SerialAttributes

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> ToString for T where
    T: Display + ?Sized
[src]

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.