Skip to main content

Widget

Enum Widget 

Source
pub enum Widget<L: Logic> {
Show 13 variants Label { text: L::Value, style: LabelStyle, }, Button { title: L::Value, style: ButtonStyle, icon: Icon, selected: Option<L::Value>, action: L::Action, }, TextField { value: L::Binding, placeholder: String, lines: u32, action: Option<L::Action>, }, Checkbox { checked: L::Binding, title: Option<L::Value>, style: ToggleStyle, }, Slider { value: L::Binding, min: i64, max: i64, }, Picker { selection: L::Binding, options: L::Value, }, NavItem { title: L::Value, value: L::Value, selection: L::Binding, icon: Icon, badge: Option<L::Value>, }, ContextMenu { entries: Vec<MenuEntry<L::Action>>, }, DropTarget { dropped: L::Binding, action: Option<L::Action>, }, Image { path: L::Value, size: ImageSize, }, Progress { value: Option<L::Value>, }, Spacer, Divider,
}

Variants§

§

Label

Fields

§text: L::Value
§

Button

Shown as selected while selected holds, when it has one.

Fields

§title: L::Value
§icon: Icon
§selected: Option<L::Value>
§action: L::Action
§

TextField

Edits text on one line, or on lines lines when more. A one-line field with an action runs it on Return.

Fields

§value: L::Binding
§placeholder: String
§lines: u32
§action: Option<L::Action>
§

Checkbox

Fields

§checked: L::Binding
§title: Option<L::Value>
§

Slider

Shows the number at value, from min to max, and writes the user’s pick there.

Fields

§value: L::Binding
§min: i64
§max: i64
§

Picker

Shows selection among options, a list of text, and writes the user’s pick there.

Fields

§selection: L::Binding
§options: L::Value
§

NavItem

Selected while selection holds value; picking it writes value there.

Fields

§title: L::Value
§value: L::Value
§selection: L::Binding
§icon: Icon
§badge: Option<L::Value>
§

ContextMenu

A right-click menu for the stack it is in, whose items run their actions.

Fields

§entries: Vec<MenuEntry<L::Action>>
§

DropTarget

Takes files and links dropped on the stack it is in, writing them to dropped, then runs action, if it has one.

Fields

§dropped: L::Binding
§action: Option<L::Action>
§

Image

The image in the file at path, shown at size.

Fields

§path: L::Value
§

Progress

A progress bar at value percent, or busy without one.

Fields

§value: Option<L::Value>
§

Spacer

§

Divider

Trait Implementations§

Source§

impl<L: Logic> Debug for Widget<L>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L> Freeze for Widget<L>
where <L as Logic>::Value: Freeze, <L as Logic>::Action: Freeze, <L as Logic>::Binding: Freeze,

§

impl<L> RefUnwindSafe for Widget<L>

§

impl<L> Send for Widget<L>
where <L as Logic>::Value: Send, <L as Logic>::Action: Send, <L as Logic>::Binding: Send,

§

impl<L> Sync for Widget<L>
where <L as Logic>::Value: Sync, <L as Logic>::Action: Sync, <L as Logic>::Binding: Sync,

§

impl<L> Unpin for Widget<L>
where <L as Logic>::Value: Unpin, <L as Logic>::Action: Unpin, <L as Logic>::Binding: Unpin,

§

impl<L> UnsafeUnpin for Widget<L>
where <L as Logic>::Value: UnsafeUnpin, <L as Logic>::Action: UnsafeUnpin, <L as Logic>::Binding: UnsafeUnpin,

§

impl<L> UnwindSafe for Widget<L>
where <L as Logic>::Value: UnwindSafe, <L as Logic>::Action: UnwindSafe, <L as Logic>::Binding: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.