Skip to main content

Response

Enum Response 

Source
#[non_exhaustive]
pub enum Response {
Show 15 variants Idle, Clicked, Pressed, Released, Focused, Defocused, Selected, Trigger, Edited, ValueChanged, Hovered, Scrolled, Disabled, User(u8), Error(GuiError),
}
Expand description

Response from a widget operation.

This enum represents the various responses that a widget can return after processing an operation, such as drawing or handling interactions.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Idle

No significant response, widget is idle.

§

Clicked

The widget was clicked (e.g., checkbox toggled).

§

Pressed

The widget is currently being pressed down.

§

Released

The widget was released.

§

Focused

The widget gained focus.

§

Defocused

The widget lost focus.

§

Selected

The widget was selected (e.g., radio button, list item).

§

Trigger

The widget was triggered (e.g., button activated).

§

Edited

The widget’s content was edited.

§

ValueChanged

The widget’s value changed.

§

Hovered

The widget is being hovered over.

§

Scrolled

The widget was scrolled.

§

Disabled

The widget was disabled.

§

User(u8)

User-defined response with custom code.

§

Error(GuiError)

An error occurred during the operation.

Implementations§

Source§

impl Response

Source

pub const fn is_idle(&self) -> bool

Returns true if the response is idle.

Source

pub const fn is_clicked(&self) -> bool

Returns true if the response is clicked.

Source

pub const fn is_pressed(&self) -> bool

Returns true if the response is pressed.

Source

pub const fn is_released(&self) -> bool

Source

pub const fn is_focused(&self) -> bool

Returns true if the response is focused.

Source

pub const fn is_defocused(&self) -> bool

Returns true if the response is defocused.

Source

pub const fn is_selected(&self) -> bool

Returns true if the response is selected.

Source

pub const fn is_trigger(&self) -> bool

Returns true if the response is trigger.

Source

pub const fn is_edited(&self) -> bool

Returns true if the response is edited.

Source

pub const fn is_value_changed(&self) -> bool

Returns true if the response indicates a value change.

Source

pub const fn is_hovered(&self) -> bool

Returns true if the response is hovered.

Source

pub const fn is_scrolled(&self) -> bool

Returns true if the response is scrolled.

Source

pub const fn is_disabled(&self) -> bool

Returns true if the response is disabled.

Source

pub const fn is_user(&self) -> bool

Returns true if the response is a user-defined response.

Source

pub fn user_code(&self) -> Option<u8>

Returns the user code if the response is a user-defined response.

Source

pub fn error(&self) -> Option<GuiError>

Returns the error if the response is an error.

Source§

impl Response

Source

pub fn from_error(error: GuiError) -> Response

Creates a response from a GUI error.

§Arguments
  • error - The error to convert into a response.
§Returns

Response::Error(error).

Source

pub fn from_change(change: bool) -> Self

Creates a response based on a change flag.

§Arguments
  • change - true if a change occurred, false otherwise.
§Returns

Response::ValueChanged if change is true, Response::Idle otherwise.

Trait Implementations§

Source§

impl Clone for Response

Source§

fn clone(&self) -> Response

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Response

Source§

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

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

impl PartialEq for Response

Source§

fn eq(&self, other: &Response) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Response

Source§

impl Eq for Response

Source§

impl StructuralPartialEq for Response

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.