Skip to main content

TemplateDesc

Struct TemplateDesc 

Source
#[repr(C)]
pub struct TemplateDesc {
Show 19 fields pub kind: TemplateKind, pub button: ButtonStyle, pub icon: Icon, pub deps: Slice<u32>, pub stack: StackStyle, pub label: LabelStyle, pub image: ImageSize, pub text: Option<ReadFn>, pub value: Option<ReadFn>, pub badge: Option<ReadFn>, pub binding: BindingDesc, pub min: i64, pub max: i64, pub lines: u32, pub action: Option<ActionFn>, pub placeholder: Str, pub children: Slice<TemplateDesc>, pub menu: Slice<MenuEntryDesc>, pub region: RegionDesc,
}
Expand description

One element of a window’s UI. Which fields matter depends on kind:

  • Stack and Scroll: stack and children.
  • Label: label and text.
  • Button: button, icon, text as its title, action, and value as whether it is selected, if it shows that.
  • TextField: binding, placeholder, lines, and action to run on Return, if it has one.
  • Checkbox and Switch: binding, and text as its title if it has one.
  • Slider: binding to its value, from min to max.
  • Picker: binding to its selection, and value as its list of options.
  • NavItem: text as its title, value, binding as its selection, icon, and badge if it has one.
  • Image: text as its file’s path, and image.
  • Progress: value as its percentage, if it has one.
  • ContextMenu: menu.
  • DropTarget: binding to the list it writes, and action to run then, if any.
  • Region: region.

deps are the state ids whose changes require showing a widget again, or rebuilding a region.

Fields§

§kind: TemplateKind§button: ButtonStyle§icon: Icon§deps: Slice<u32>§stack: StackStyle§label: LabelStyle§image: ImageSize§text: Option<ReadFn>§value: Option<ReadFn>§badge: Option<ReadFn>§binding: BindingDesc§min: i64§max: i64§lines: u32§action: Option<ActionFn>§placeholder: Str§children: Slice<TemplateDesc>§menu: Slice<MenuEntryDesc>§region: RegionDesc

Implementations§

Source§

impl TemplateDesc

Source

pub const fn empty(kind: TemplateKind) -> Self

A template of kind with every other field empty, to build on.

Trait Implementations§

Source§

impl Debug for TemplateDesc

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> AutoreleaseSafe for T
where T: ?Sized,

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.