cushy::widgets::label

Trait DynamicDisplay

Source
pub trait DynamicDisplay {
    // Required method
    fn fmt(&self, context: &WidgetContext<'_>, f: &mut Formatter<'_>) -> Result;

    // Provided methods
    fn generation(&self, context: &WidgetContext<'_>) -> Option<Generation> { ... }
    fn as_display<'display, 'ctx>(
        &'display self,
        context: &'display WidgetContext<'ctx>,
    ) -> DynamicDisplayer<'display, 'ctx>
       where Self: Sized { ... }
    fn into_label(self) -> Label<Self>
       where Self: Debug + Sized + Send + 'static { ... }
    fn to_label(&self) -> Label<Self>
       where Self: Clone + Debug + Sized + Send + 'static { ... }
}
Expand description

A context-aware Display implementation.

This trait is automatically implemented for all types that implement Display.

Required Methods§

Source

fn fmt(&self, context: &WidgetContext<'_>, f: &mut Formatter<'_>) -> Result

Format self with any needed information from context.

Provided Methods§

Source

fn generation(&self, context: &WidgetContext<'_>) -> Option<Generation>

Returns a generation representing the current state of the dynamic.

To ensure the contents are recached by a Label widget, return a unique value from this function each time the contents are updated.

Source

fn as_display<'display, 'ctx>( &'display self, context: &'display WidgetContext<'ctx>, ) -> DynamicDisplayer<'display, 'ctx>
where Self: Sized,

Returns a type that implements Display.

Source

fn into_label(self) -> Label<Self>
where Self: Debug + Sized + Send + 'static,

Returns self being Displayed in a Label widget.

Source

fn to_label(&self) -> Label<Self>
where Self: Clone + Debug + Sized + Send + 'static,

Returns self being Displayed in a Label widget.

Implementors§