[][src]Struct cnx::Cnx

pub struct Cnx { /* fields omitted */ }

The main object, used to instantiate an instance of Cnx.

The cnx_add_widget!() macro can be used to add widgets to the Cnx instance. Once configured, the run() method will take ownership of the instance and run it until the process is killed or an error is returned.

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, ActiveWindowTitle::new(&cnx, attr.clone()));
cnx_add_widget!(cnx, Clock::new(&cnx, attr.clone()));
cnx.run()?;

Methods

impl Cnx[src]

pub fn new(position: Position) -> Result<Cnx>[src]

Creates a new Cnx instance.

This creates a new Cnx instance at either the top or bottom of the screen, depending on the value of the Position enum.

Examples

let mut cnx = Cnx::new(Position::Top);
let mut cnx = Cnx::new(Position::Bottom);

pub fn add_widget<W>(&mut self, widget: W) where
    W: Widget + 'static, 
[src]

Adds a widget to the Cnx instance.

This method takes a Widget and adds it to the current Cnx instance, to the right of any existing widgets.

It is recommended that you instead use the cnx_add_widget!() macro, as this will eventually grow to have a more flexible syntax for configuring widget attributes.

pub fn run(self) -> Result<()>[src]

Runs the Cnx instance.

This method takes ownership of the Cnx instance and runs it until either the process is terminated, or an internal error is returned.

Auto Trait Implementations

impl !Send for Cnx

impl !Sync for Cnx

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