[][src]Struct cnx::widgets::Sensors

pub struct Sensors { /* fields omitted */ }

Shows the temperature from one or more sensors.

This widget shows the temperature reported by one or more sensors from the output of the sensors command, which is part of the lm_sensors package.

It expects the sensors executable to be available in the PATH.

Methods

impl Sensors[src]

pub fn new<S: Into<String>>(
    cnx: &Cnx,
    attr: Attributes,
    sensors: Vec<S>
) -> Sensors
[src]

Creates a new Sensors widget.

Creates a new Sensors widget, whose text will be displayed with the given Attributes.

A list of sensor names should be passed as the sensors argument. (You can discover the names by running the sensors utility in a terminal).

The Cnx instance is borrowed during construction in order to get access to handles of its event loop. However, it is not borrowed for the lifetime of the widget. See the cnx_add_widget!() for more discussion about the lifetime of the borrow.

Examples

let attr = Attributes {
    font: Font::new("SourceCodePro 21"),
    fg_color: Color::white(),
    bg_color: None,
    padding: Padding::new(8.0, 8.0, 0.0, 0.0),
};

let mut cnx = Cnx::new(Position::Top)?;
cnx_add_widget!(
    cnx,
    Sensors::new(&cnx, attr.clone(), vec!["Core 0", "Core 1"])
);

Trait Implementations

Auto Trait Implementations

impl !Send for Sensors

impl !Sync for Sensors

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T