Skip to main content

Quantity

Struct Quantity 

Source
pub struct Quantity {
Show 20 fields pub id: String, pub label: String, pub value: f64, pub dim: Dim, pub bind: Option<Bind>, pub min: Option<f64>, pub max: Option<f64>, pub decimals: usize, pub error: Option<String>, pub speed: Option<f64>, pub width: Option<f32>, pub enabled: bool, pub focus: bool, pub unit: Option<String>, pub stepper: Option<Stepper>, pub bare: bool, pub drag_min: Option<f64>, pub drag_max: Option<f64>, pub shown: Option<String>, pub held: Option<bool>,
}
Expand description

A Widget::Quantity: a number as a Widget::Number says it, with how it drags and how wide it is. Bound to a parameter (bind), it takes formulas as a bound Number does. Changes come back as PanelEvent::Number; a stepper’s buttons as the value one up or down.

Fields§

§id: String§label: String§value: f64§dim: Dim§bind: Option<Bind>§min: Option<f64>§max: Option<f64>§decimals: usize§error: Option<String>§speed: Option<f64>

How much the value moves per point dragged; left out, as a bound Number drags.

§width: Option<f32>

Its width in points.

§enabled: bool§focus: bool

Takes the keyboard focus this frame, as a field just made does.

§unit: Option<String>

Written after the value in place of the dim’s unit: N·m.

§stepper: Option<Stepper>

The value between a down and an up button, in place of a field.

§bare: bool

The system’s bare number drag in place of the panel’s field: its unit written after the value as given, its decimals as the value needs (none when decimals is 0).

§drag_min: Option<f64>

The least and largest values a drag (or the wheel, or a stepper’s buttons) sets, inside min and max: a drag stops there, where a typed value may go past. For a size that builds only up to a limit, so that only typing can ask for one that fails.

§drag_max: Option<f64>§shown: Option<String>

The field’s text as the package has it, written in place of the value and not edited there: a value typed through the bench’s own keys, a formula with what it comes to. focus then rings the field as the one those keys type into.

§held: Option<bool>

A lock after the field, shut while the value is held (typed, it no longer follows the cursor). A click on it comes back as PanelEvent::Toggle with the field’s id.

Trait Implementations§

Source§

impl Clone for Quantity

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Quantity

Source§

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

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

impl Default for Quantity

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Quantity

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Quantity> for Widget

Source§

fn from(block: Quantity) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Quantity

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Quantity

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Quantity

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> 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.