Struct abar::StatusBlock [−][src]
pub struct StatusBlock { /* fields omitted */ }Expand description
Encapsulates a Fn() -> String closure.
Each StatusBlock has a unique name, some command that returns a string, and a polling interval. The result of the command will be cached, and will be updated iff the update() method is called and the time since the last update is > the polling interval.
Building
StatusBlocks follow the builder pattern for instantiation, so to make a new one you might use something like this:
let block = StatusBlock::new()
.name("example")
.command(&|| "hello".to_string())
.poll_interval(Duration::from_secs(5));Implementations
Returns a new StatusBlock with default values. The defaults are:
StatusBlock {
name: String::new(),
command: Box::new(|| String::new()),
poll_interval: None,
}