NumericTypeSettings

Struct NumericTypeSettings 

Source
pub struct NumericTypeSettings {
Show 15 fields pub widget: NumericWidgetKind, pub range: NumericRange, pub speed: Option<f64>, pub step: Option<f64>, pub step_fast: Option<f64>, pub format: Option<String>, pub log: bool, pub clamp: bool, pub always_clamp: bool, pub wrap_around: bool, pub no_round_to_format: bool, pub no_input: bool, pub clamp_on_input: bool, pub clamp_zero_range: bool, pub no_speed_tweaks: bool,
}
Expand description

Type-level settings controlling how a particular numeric primitive type is rendered.

Fields§

§widget: NumericWidgetKind

Default widget kind for this numeric type.

§range: NumericRange

Default range behavior for this numeric type.

§speed: Option<f64>

Default drag speed (for drag widgets), stored as f64.

§step: Option<f64>

Default step size (for input widgets), stored as f64.

§step_fast: Option<f64>

Default fast step size (for input widgets), stored as f64.

§format: Option<String>

Default printf-style numeric format, if any.

§log: bool

Logarithmic scale flag for slider/drag widgets.

§clamp: bool

Post-edit manual clamp (our own helper, distinct from ImGui flags).

§always_clamp: bool

Always-clamp flag for slider/drag widgets.

§wrap_around: bool

Wrap-around flag for slider widgets.

§no_round_to_format: bool

Disable rounding to format for slider/drag widgets.

§no_input: bool

Disable direct text input on sliders.

§clamp_on_input: bool

Clamp when editing via text input.

§clamp_zero_range: bool

Clamp zero-range behavior.

§no_speed_tweaks: bool

Disable built-in speed tweaks for drag widgets.

Implementations§

Source§

impl NumericTypeSettings

Source

pub fn with_format<S: Into<String>>(self, fmt: S) -> Self

Set an explicit printf-style format string for this numeric type.

This is a convenience helper for configuring the underlying ImGui scalar/slider/drag widgets, equivalent to assigning format directly.

Source

pub fn without_format(self) -> Self

Clear any explicit format and fall back to Dear ImGui’s defaults.

Source

pub fn with_decimal(self) -> Self

Decimal integer format (%d).

Intended for signed integer types such as i32.

Source

pub fn with_unsigned(self) -> Self

Unsigned decimal integer format (%u).

Intended for unsigned integer types such as u32.

Source

pub fn with_hex(self, uppercase: bool) -> Self

Hexadecimal integer format (%x or %X).

Source

pub fn with_octal(self) -> Self

Octal integer format (%o).

Source

pub fn with_int_padded(self, width: u32, pad_char: char) -> Self

Padded decimal integer format, e.g. width=4, pad_char=‘0’ -> %04d.

This is a small convenience for typical zero-padded integer displays; callers should ensure the format matches the underlying numeric type.

Source

pub fn with_char(self) -> Self

Character format (%c), useful for small integer types interpreted as chars.

Source

pub fn with_float(self, precision: u32) -> Self

Floating-point format %.Nf, e.g. precision=3 -> %.3f.

Source

pub fn with_double(self, precision: u32) -> Self

Double format %.Nlf, primarily for parity with ImReflect’s helpers.

Source

pub fn with_scientific(self, precision: u32, uppercase: bool) -> Self

Scientific notation %.Ne / %.NE.

Source

pub fn with_percentage(self, precision: u32) -> Self

Percentage format %.Nf%% (e.g. 12.3%).

Source

pub fn slider_0_to_1(self, precision: u32) -> Self

Convenience preset: slider in the range [0, 1] with clamping and a floating-point display format %.Nf.

This is primarily intended for floating-point types (f32 / f64).

Source

pub fn slider_minus1_to_1(self, precision: u32) -> Self

Convenience preset: slider in the range [-1, 1] with clamping and a floating-point display format %.Nf.

This is primarily intended for floating-point types (f32 / f64).

Source

pub fn drag_with_speed(self, speed: f64, precision: u32) -> Self

Convenience preset: drag widget with a given speed and floating-point display format %.Nf.

This is primarily intended for floating-point types.

Source

pub fn percentage_slider_0_to_1(self, precision: u32) -> Self

Convenience preset: slider in [0, 1] displayed as a percentage %.Nf%% with clamping.

This expects the underlying numeric value to live in the 0..1 range.

Trait Implementations§

Source§

impl Clone for NumericTypeSettings

Source§

fn clone(&self) -> NumericTypeSettings

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 NumericTypeSettings

Source§

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

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

impl Default for NumericTypeSettings

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more