Skip to main content

Widget

Trait Widget 

Source
pub trait Widget<C: Context, S = Build> {
    type Response;

    // Required method
    fn build(self, ui: Ui<'_, C, S>) -> Self::Response;
}
Expand description

builds part of the ui each frame and returns a response such as whether it was clicked

  • by default a widget owns a node it can lay out
  • state::Insert widgets add content like text or backgrounds to the node through Ui::insert without changing the node itself

Required Associated Types§

Required Methods§

Source

fn build(self, ui: Ui<'_, C, S>) -> Self::Response

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<C: Context> Widget<C, Insert> for ()

Source§

type Response = ()

Source§

fn build(self, _: Ui<'_, C, Insert>)

Implementors§

Source§

impl<C: Context, F, O> Widget<C> for F
where F: FnOnce(Ui<'_, C>) -> O,