Skip to main content

Semantic

Struct Semantic 

Source
pub struct Semantic<'a, Message, Theme, Renderer, R: RoleKind = AnyRole> { /* private fields */ }
Expand description

An element with an annotation. Convert it into an Element to use it.

With the semantics feature on it is a widget that forwards everything to its content and reports the annotation to the recorder. With the feature off, converting it gives back the content itself.

Implementations§

Source§

impl<'a, Message, Theme, Renderer, R: RoleKind> Semantic<'a, Message, Theme, Renderer, R>

Source

pub fn name(self, name: impl IntoFragment<'a>) -> Self

The accessible name.

Source

pub fn description(self, text: impl IntoFragment<'a>) -> Self

A longer description.

Source

pub fn tooltip(self, text: impl IntoFragment<'a>) -> Self

The tooltip text, which names an otherwise unnamed node.

Source

pub fn test_id(self, id: impl IntoTestId<'a>) -> Self

A test id, typed through TestId or a string built at run time.

Source

pub fn kind(self, kind: &'static str) -> Self

What reported the node, for of_type and the inspector. "app" when unset.

Source

pub fn component(self, kind: &'static str) -> Self

Marks the annotation as a component library’s, such as "iced_cube::tree". App annotations at the same bounds take precedence over it.

Source

pub fn prop(self, key: &'static str, value: impl IntoFragment<'a>) -> Self

A free-form property, such as a tab’s unsaved.

Source

pub fn text_size(self, size: impl Into<Pixels>) -> Self

The text size in logical pixels.

Source

pub fn click_clock(self, clock: ClickClock) -> Self

Which clock counts multiple clicks.

Source

pub fn caret_clock(self, clock: CaretClock) -> Self

Which clock blinks the caret.

Source

pub fn disabled(self, on: bool) -> Self

The node takes no input.

Source

pub fn current(self, on: bool) -> Self

The current item in a set, such as the open page in a sidebar.

Source

pub fn busy(self, on: bool) -> Self

The node is loading or updating.

Source

pub fn hidden(self, on: bool) -> Self

The node is not shown, such as a hover-only control while the pointer is elsewhere.

Source

pub fn modal(self, on: bool) -> Self

Everything outside the node is inert while it is shown.

Source

pub fn required(self, on: bool) -> Self

A form control must be filled in.

Source

pub fn invalid(self, on: bool) -> Self

A form control’s value is rejected.

Source

pub fn readonly(self, on: bool) -> Self

The node shows a value that cannot be changed.

Source

pub fn position(self, index: u32, of: u32) -> Self

The position in its set, counted from 1, and the size of the set.

Source

pub fn key(self, key: impl Into<Key>) -> Self

The key other annotations use to name this one.

Source

pub fn labelled_by(self, key: impl Into<Key>) -> Self

The node whose name labels this one.

Source

pub fn label_for(self, key: impl Into<Key>) -> Self

The node this one labels.

Source

pub fn described_by(self, key: impl Into<Key>) -> Self

The node whose text describes this one.

Source

pub fn controls(self, key: impl Into<Key>) -> Self

The node this one controls, such as the panel a disclosure button opens.

Source

pub fn owns(self, key: impl Into<Key>) -> Self

A node that is this one’s logical child although it lives elsewhere, such as an overlay panel.

Source

pub fn checked(self, state: impl Into<Checked>) -> Self
where R: Checkable,

Checked, unchecked or mixed.

Source

pub fn pressed(self, on: bool) -> Self
where R: Pressable,

Whether a toggle button is pressed.

Source

pub fn expanded(self, on: bool) -> Self
where R: Expandable,

Whether the node’s content or popup is shown.

Source

pub fn selected(self, on: bool) -> Self
where R: SelectableItem,

Whether the item is selected in its container.

Source

pub fn level(self, level: u16) -> Self
where R: Leveled,

The nesting level, from 1. A 0 is reported as a tree warning.

Source

pub fn value(self, text: impl IntoFragment<'a>) -> Self
where R: HasValue,

The value as text.

Source

pub fn range(self, now: f64, range: RangeInclusive<f64>) -> Self
where R: RangeValue,

A numeric value within a range.

Source

pub fn step(self, step: f64) -> Self
where R: RangeValue,

The distance between neighbouring values of the range, such as 1 for a slider over whole steps. With it, set_value moves a focusable slider with the keyboard and lands exactly on the value however its steps are placed along the track.

Source

pub fn placeholder(self, text: impl IntoFragment<'a>) -> Self
where R: Editable,

The placeholder shown while the value is empty.

Source

pub fn multiline(self, on: bool) -> Self
where R: Editable,

Whether the text box takes more than one line.

Source§

impl<'a, Message, Theme, Renderer, R: RoleKind> Semantic<'a, Message, Theme, Renderer, R>

Source

pub fn role<R2: RoleType>( self, role: R2, ) -> Semantic<'a, Message, Theme, Renderer, R2>
where R: Untyped,

Gives the element a role. Only once: a second call does not compile.

Trait Implementations§

Source§

impl<Message, Theme, Renderer, R: RoleKind> Debug for Semantic<'_, Message, Theme, Renderer, R>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, Message, Theme, Renderer, R> From<Semantic<'a, Message, Theme, Renderer, R>> for Element<'a, Message, Theme, Renderer>
where Message: 'a, Theme: 'a, Renderer: Renderer + 'a, R: RoleKind,

Source§

fn from(semantic: Semantic<'a, Message, Theme, Renderer, R>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, Message, Theme, Renderer, R = AnyRole> !RefUnwindSafe for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R = AnyRole> !Send for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R = AnyRole> !Sync for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R = AnyRole> !UnwindSafe for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R> Forget for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R> Freeze for Semantic<'a, Message, Theme, Renderer, R>
where *const dyn Widget<Message, Theme, Renderer> + 'a is !null: Freeze, PhantomData<dyn Widget<Message, Theme, Renderer> + 'a>: Freeze, PhantomData<(fn() -> R, &'a ())>: Freeze,

§

impl<'a, Message, Theme, Renderer, R> Move for Semantic<'a, Message, Theme, Renderer, R>

§

impl<'a, Message, Theme, Renderer, R> Unpin for Semantic<'a, Message, Theme, Renderer, R>
where Box<dyn Widget<Message, Theme, Renderer> + 'a>: Unpin, &'a (): Unpin,

§

impl<'a, Message, Theme, Renderer, R> UnsafeUnpin for Semantic<'a, Message, Theme, Renderer, R>
where *const dyn Widget<Message, Theme, Renderer> + 'a is !null: UnsafeUnpin, PhantomData<dyn Widget<Message, Theme, Renderer> + 'a>: UnsafeUnpin, PhantomData<(fn() -> R, &'a ())>: UnsafeUnpin,

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<'a, Message, Theme, Renderer, T> SemanticExt<'a, Message, Theme, Renderer> for T
where T: Into<Element<'a, Message, Theme, Renderer>>,

Source§

fn semantic(self) -> Semantic<'a, Message, Theme, Renderer, AnyRole>

Wraps the element so it can be described.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.