pub struct NumberEditor { /* private fields */ }Expand description
Edits a cell as a number, on gpui-kit’s Input with a number mask. The
kind follows the cell’s value (Int, Float, Decimal; Float for an
empty cell) unless Self::with_kind sets it; an empty draft is
Empty.
The field starts from the exact value, not the two decimals the cell
shows. A draft is parsed with
Self::with_decimal_separator between the whole and fractional
digits; spaces and the other separator, a thousands one, are dropped.
Typing starts an edit only with a digit, a sign or a separator.
Implementations§
Source§impl NumberEditor
impl NumberEditor
Sourcepub fn new() -> Self
pub fn new() -> Self
A number editor of the cell’s kind, without limits, with . between
the whole and fractional digits.
Sourcepub fn with_kind(self, kind: NumberKind) -> Self
pub fn with_kind(self, kind: NumberKind) -> Self
Commits numbers of kind, whatever the cell holds.
Sourcepub fn with_min(self, min: impl Into<OwnedValue>) -> Self
pub fn with_min(self, min: impl Into<OwnedValue>) -> Self
Refuses a number below min.
Sourcepub fn with_max(self, max: impl Into<OwnedValue>) -> Self
pub fn with_max(self, max: impl Into<OwnedValue>) -> Self
Refuses a number above max.
Sourcepub fn with_scale(self, scale: u32) -> Self
pub fn with_scale(self, scale: u32) -> Self
Refuses a number with more than scale decimals (trailing zeros do
not count).
Sourcepub fn with_decimal_separator(self, separator: char) -> Self
pub fn with_decimal_separator(self, separator: char) -> Self
Sets the character between the whole and fractional digits (default
.; , for a Russian-language product).
gpui-kit’s number mask knows only .: with another separator the
field takes any text and the parser refuses what is not a number.
Sourcepub fn kind(&self) -> Option<NumberKind>
pub fn kind(&self) -> Option<NumberKind>
The kind set with Self::with_kind.
Sourcepub fn min(&self) -> Option<&OwnedValue>
pub fn min(&self) -> Option<&OwnedValue>
The smallest number taken.
Sourcepub fn max(&self) -> Option<&OwnedValue>
pub fn max(&self) -> Option<&OwnedValue>
The largest number taken.
Sourcepub fn decimal_separator(&self) -> char
pub fn decimal_separator(&self) -> char
The character between the whole and fractional digits.
Trait Implementations§
Source§impl<R: GridRow> CellEditor<R> for NumberEditor
impl<R: GridRow> CellEditor<R> for NumberEditor
Source§fn open(
&self,
start: &EditorStart<'_, R>,
window: &mut Window,
cx: &mut App,
) -> EditorOpen
fn open( &self, start: &EditorStart<'_, R>, window: &mut Window, cx: &mut App, ) -> EditorOpen
Source§impl Clone for NumberEditor
impl Clone for NumberEditor
Source§fn clone(&self) -> NumberEditor
fn clone(&self) -> NumberEditor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NumberEditor
impl Debug for NumberEditor
Auto Trait Implementations§
impl Freeze for NumberEditor
impl !RefUnwindSafe for NumberEditor
impl Send for NumberEditor
impl Sync for NumberEditor
impl Unpin for NumberEditor
impl UnsafeUnpin for NumberEditor
impl !UnwindSafe for NumberEditor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().