pub struct Number { /* private fields */ }Expand description
(number feature) Accepts either an integer or a float, without converting between them.
Use this when a value may legitimately be whole or fractional and you want to keep its original type. Optional inclusive bounds and sign constraints compare the value numerically but never rewrite it.
Implementations§
Source§impl Number
impl Number
Sourcepub fn with_meta(self, meta: Meta) -> Self
pub fn with_meta(self, meta: Meta) -> Self
Attach human-facing metadata (name, description, examples, default, output conversion).
pub fn new() -> Self
pub fn min(self, min: f64) -> Self
pub fn max(self, max: f64) -> Self
pub fn range(self, start: f64, end: f64) -> Self
Sourcepub fn non_negative(self) -> Self
pub fn non_negative(self) -> Self
Require the value to be greater than or equal to zero.
Sourcepub fn non_positive(self) -> Self
pub fn non_positive(self) -> Self
Require the value to be less than or equal to zero.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnsafeUnpin for Number
impl UnwindSafe for Number
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> WithMeta for Twhere
T: Validator,
impl<T> WithMeta for Twhere
T: Validator,
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
The description, if any.
Source§fn examples(&self) -> &[(Value, Option<String>)]
fn examples(&self) -> &[(Value, Option<String>)]
The example values (each with an optional note).
Source§fn default_value(&self) -> Option<&Value>
fn default_value(&self) -> Option<&Value>
The default value, if any.
Source§fn with_name(self, name: impl Into<String>) -> Self
fn with_name(self, name: impl Into<String>) -> Self
Set the human-readable name (surfaced in error messages).
Source§fn with_description(self, text: impl Into<String>) -> Self
fn with_description(self, text: impl Into<String>) -> Self
Attach a human-readable description.
Source§fn with_example(self, value: impl Into<Value>) -> Self
fn with_example(self, value: impl Into<Value>) -> Self
Add an example value.
Source§fn with_example_noted(
self,
value: impl Into<Value>,
note: impl Into<String>,
) -> Self
fn with_example_noted( self, value: impl Into<Value>, note: impl Into<String>, ) -> Self
Add an example value with an explanatory note.
Source§fn with_default(self, value: impl Into<Value>) -> Self
fn with_default(self, value: impl Into<Value>) -> Self
Set the default value used as an on-error fallback (see the pipeline’s validate stage).