Struct 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, K> Slider<'ui, T, K>
where T: AsRef<str>, K: DataTypeKind,

Source

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

👎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) -> Slider<'ui, Label, Data, Format>

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>( self, display_format: Format2, ) -> Slider<'ui, Label, Data, Format2>
where Format2: AsRef<str>,

Sets the display format using a C-style printf string

Source

pub fn flags(self, flags: SliderFlags) -> Slider<'ui, Label, Data, Format>

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, Data, Format> Clone for Slider<'ui, Label, Data, Format>
where Label: Clone, Data: Clone, Format: Clone,

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

Source§

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

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

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

Auto Trait Implementations§

§

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

§

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 Label: Unpin, Data: Unpin, Format: Unpin,

§

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

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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V