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§