Struct redblocks::plugins::TimePlugin[][src]

pub struct TimePlugin {
    pub time: String,
    pub format: String,
}
Expand description

Displays the current time.

Using the default configuration

formats to “Saturday 06/26/2021 3:41:48 pm”

#[macro_use]
extern crate redblocks;

use redblocks::{plugins::TimePlugin, Widget};

fn main() {
    let time = Box::new(TimePlugin::default());
    let time = vec![Widget::new(time, 1)];

    start_bar!(time);
}

Using a custom format

for formating options see the strftime module

#[macro_use]
extern crate redblocks;

use redblocks::{plugins::TimePlugin, Widget};

fn main() {
    let time = TimePlugin::new("%H%M%S"); // formats to "14:23:08"
    let time = vec![Widget::new(time, 1)];

    start_bar!(time);
}

Fields

time: String

holds the time formated as a string

format: String

holds the formating string

Implementations

Trait Implementations

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.