Skip to main content

Widget

Trait Widget 

Source
pub trait Widget: Send + Sync {
    // Required methods
    fn code(&self) -> &str;
    fn label(&self) -> Text;
    fn render<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        cx: &'life1 WidgetCx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Markup, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn description(&self) -> Option<Text> { ... }
    fn permission(&self) -> Option<&str> { ... }
    fn size(&self) -> Size { ... }
    fn refresh(&self) -> Option<u32> { ... }
}
Expand description

A block on the dashboard.

Required Methods§

Source

fn code(&self) -> &str

vendor.name, unique across modules.

Source

fn label(&self) -> Text

Shown as the widget’s heading and in the Manage dialog.

Source

fn render<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, cx: &'life1 WidgetCx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Markup, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The widget’s body. An Err renders as a notice inside the frame, never as a failed page.

Provided Methods§

Source

fn description(&self) -> Option<Text>

A line under the label in the Manage dialog.

Source

fn permission(&self) -> Option<&str>

The permission an operator needs to see it; None shows it to every operator.

Source

fn size(&self) -> Size

The width it takes until an operator chooses another.

Source

fn refresh(&self) -> Option<u32>

Seconds between refreshes of its body, fetched on its own; None renders once with the page.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§