[−][src]Struct cnx::widgets::Clock
Shows the current time and date.
This widget shows the current time and date, in the form %Y-%m-%d %a %I:%M %p
, e.g. 2017-09-01 Fri 12:51 PM
.
Methods
impl Clock
[src]
pub fn new(cnx: &Cnx, attr: Attributes) -> Clock
[src]
Creates a new Clock widget.
Creates a new Clock
widget, whose text will be displayed with the
given Attributes
.
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, Clock::new(&cnx, attr.clone()));
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.