Struct imgui::Slider

source ·
pub struct Slider<'ui, Label, Data, Format = &'static str> { /* private fields */ }
Expand description

Builder for a slider widget.

Implementations§

source§

impl<'ui, T: AsRef<str>, K: DataTypeKind> Slider<'ui, T, K>

source

pub fn new(ui: &'ui Ui, label: T, min: K, max: K) -> Self

👎Deprecated since 0.9.0: Use Ui::slider or Ui::slider_config.

Constructs a new slider builder with the given range.

source§

impl<'ui, Label, Data, Format> Slider<'ui, Label, Data, Format>where Label: AsRef<str>, Data: DataTypeKind, Format: AsRef<str>,

source

pub fn range(self, min: Data, max: Data) -> Self

Sets the range inclusively, such that both values given are valid values which the slider can be dragged to.

ui.slider_config("Example", i8::MIN, i8::MAX)
    .range(4, 8)
    // Remember to call .build()
    ;

It is safe, though up to C++ Dear ImGui, on how to handle when min > max.

Note for f32 and f64 sliders, Dear ImGui limits the available range to half their full range (e.g f32::MIN/2.0 .. f32::MAX/2.0) Specifying a value above this will cause an abort. For large ranged values, consider using Ui::input_scalar instead

source

pub fn display_format<Format2: AsRef<str>>( self, display_format: Format2 ) -> Slider<'ui, Label, Data, Format2>

Sets the display format using a C-style printf string

source

pub fn flags(self, flags: SliderFlags) -> Self

Replaces all current settings with the given flags

source

pub fn build(self, value: &mut Data) -> bool

Builds a slider that is bound to the given value.

Returns true if the slider value was changed.

source

pub fn build_array(self, values: &mut [Data]) -> bool

Builds a horizontal array of multiple sliders attached to the given slice.

Returns true if any slider value was changed.

Trait Implementations§

source§

impl<'ui, Label: Clone, Data: Clone, Format: Clone> Clone for Slider<'ui, Label, Data, Format>

source§

fn clone(&self) -> Slider<'ui, Label, Data, Format>

Returns a copy 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<'ui, Label: Debug, Data: Debug, Format: Debug> Debug for Slider<'ui, Label, Data, Format>

source§

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

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

impl<'ui, Label: Copy, Data: Copy, Format: Copy> Copy for Slider<'ui, Label, Data, Format>

Auto Trait Implementations§

§

impl<'ui, Label, Data, Format = &'static str> !RefUnwindSafe for Slider<'ui, Label, Data, Format>

§

impl<'ui, Label, Data, Format = &'static str> !Send for Slider<'ui, Label, Data, Format>

§

impl<'ui, Label, Data, Format = &'static str> !Sync for Slider<'ui, Label, Data, Format>

§

impl<'ui, Label, Data, Format> Unpin for Slider<'ui, Label, Data, Format>where Data: Unpin, Format: Unpin, Label: Unpin,

§

impl<'ui, Label, Data, Format = &'static str> !UnwindSafe for Slider<'ui, Label, Data, Format>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.