pub struct NativeStepperView { /* private fields */ }Expand description
A real increment/decrement control rendered from pure Rust — UIStepper
on iOS/iPadOS, NSStepper on macOS, and a frust-drawn refusal banner
everywhere else (Android included: see [STEPPER_ARM]). A controlled
component, like NativeSliderView: the app owns value, and a tap on
either button only ever arrives through Self::on_change as a
requested value. Build one with native_stepper.
min/max/Self::step are normalized before they ever reach a
platform control (crate::controls::stepper’s module doc’s Range and
step invariants: UIStepper aborts the process on a non-positive
stepValue or a maximumValue not strictly greater than
minimumValue). A degenerate range (max <= min) renders the control
disabled — the user can never tap it, and no value outside [min, max] is ever reported — rather than refusing to mount or crashing; it
re-enables the moment a later update makes the range non-degenerate
again.
Implementations§
Source§impl NativeStepperView
impl NativeStepperView
Sourcepub fn step(self, step: i32) -> Self
pub fn step(self, step: i32) -> Self
The increment a tap on either button applies — default 1. A
non-positive value (0 or negative) is normalized to 1 before it
ever reaches a platform control, logged once per process —
UIStepper requires stepValue > 0 (crate::controls::stepper’s
module doc’s Range and step invariants).
Sourcepub fn wraps(self, wraps: bool) -> Self
pub fn wraps(self, wraps: bool) -> Self
Whether the value wraps from max back to min (and back) instead
of clamping at the bounds — default false.
Sourcepub fn enabled(self, enabled: bool) -> Self
pub fn enabled(self, enabled: bool) -> Self
UIControl.enabled / NSControl.enabled — default true.
Sourcepub fn content_description(self, label: impl Into<String>) -> Self
pub fn content_description(self, label: impl Into<String>) -> Self
The VoiceOver label.
Sourcepub fn size(self, width: f64, height: f64) -> Self
pub fn size(self, width: f64, height: f64) -> Self
Explicit slot size — see [resolve_size]’s doc for the no-call
fallback.
Sourcepub fn on_change(self, handler: impl Fn(i32) + Send + Sync + 'static) -> Self
pub fn on_change(self, handler: impl Fn(i32) + Send + Sync + 'static) -> Self
Fires with the requested app-space value on a tap
(crate::controls::stepper’s platform-space mapping already undone —
the same mapping NativeSliderView::on_change documents). Never
fires on a target with no stepper arm.
Trait Implementations§
Source§impl Clone for NativeStepperView
impl Clone for NativeStepperView
Source§impl Component for NativeStepperView
impl Component for NativeStepperView
Source§impl<Outer: 'static> View<Outer> for NativeStepperView
impl<Outer: 'static> View<Outer> for NativeStepperView
Source§type Element = ComponentWidget<NativeStepperView>
type Element = ComponentWidget<NativeStepperView>
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> Self::Element
fn build(&self, ctx: &mut BuildCtx<'_>) -> Self::Element
Source§fn rebuild(
&self,
prev: &Self,
element: &mut Self::Element,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut Self::Element, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl !RefUnwindSafe for NativeStepperView
impl !UnwindSafe for NativeStepperView
impl Freeze for NativeStepperView
impl Send for NativeStepperView
impl Sync for NativeStepperView
impl Unpin for NativeStepperView
impl UnsafeUnpin for NativeStepperView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.