pub struct PositiveInt(/* private fields */);Expand description
Strictly positive i64 (value > 0).
Implementations§
Source§impl PositiveInt
impl PositiveInt
Sourcepub fn new(value: i64) -> Result<Self, FieldError>
pub fn new(value: i64) -> Result<Self, FieldError>
Validate value > 0 and wrap it.
Sourcepub fn into_inner(self) -> i64
pub fn into_inner(self) -> i64
Unwrap the inner integer.
Trait Implementations§
Source§impl AsRef<i64> for PositiveInt
impl AsRef<i64> for PositiveInt
Source§impl Clone for PositiveInt
impl Clone for PositiveInt
Source§fn clone(&self) -> PositiveInt
fn clone(&self) -> PositiveInt
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PositiveInt
Source§impl Debug for PositiveInt
impl Debug for PositiveInt
Source§impl Deref for PositiveInt
impl Deref for PositiveInt
Source§impl<'de> Deserialize<'de> for PositiveInt
impl<'de> Deserialize<'de> for PositiveInt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PositiveInt
impl Display for PositiveInt
Source§impl Dump for PositiveInt
impl Dump for PositiveInt
Source§fn serialize_dump<S: Serializer>(
&self,
serializer: S,
opts: &DumpOptions,
) -> Result<S::Ok, S::Error>
fn serialize_dump<S: Serializer>( &self, serializer: S, opts: &DumpOptions, ) -> Result<S::Ok, S::Error>
Serialize directly when supported, preserving
dump semantics. Read moreimpl Eq for PositiveInt
Source§impl From<PositiveInt> for i64
impl From<PositiveInt> for i64
Source§fn from(value: PositiveInt) -> Self
fn from(value: PositiveInt) -> Self
Converts to this type from the input type.
Source§impl Hash for PositiveInt
impl Hash for PositiveInt
Source§impl Ord for PositiveInt
impl Ord for PositiveInt
Source§fn cmp(&self, other: &PositiveInt) -> Ordering
fn cmp(&self, other: &PositiveInt) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PositiveInt
impl PartialEq for PositiveInt
Source§impl PartialOrd for PositiveInt
impl PartialOrd for PositiveInt
Source§impl Schema for PositiveInt
impl Schema for PositiveInt
Source§fn schema(_: &mut SchemaRegistry) -> SchemaObject
fn schema(_: &mut SchemaRegistry) -> SchemaObject
The schema definition of this type. Use
SchemaRegistry::subschema for nested types.Source§fn schema_name() -> Option<&'static str>
fn schema_name() -> Option<&'static str>
Stable component name. Named types are emitted once under
components.schemas and referenced with $ref.Source§impl Serialize for PositiveInt
impl Serialize for PositiveInt
impl StructuralPartialEq for PositiveInt
Source§impl TryFrom<i64> for PositiveInt
impl TryFrom<i64> for PositiveInt
Source§impl Validate for PositiveInt
impl Validate for PositiveInt
Source§fn prepare(input: &mut Value, ctx: &mut ValidationContext)
fn prepare(input: &mut Value, ctx: &mut ValidationContext)
Check and normalise the raw input for this type in place.
Source§fn validate(&self, _ctx: &mut ValidationContext)
fn validate(&self, _ctx: &mut ValidationContext)
Check invariants of the deserialized value.
Auto Trait Implementations§
impl Freeze for PositiveInt
impl RefUnwindSafe for PositiveInt
impl Send for PositiveInt
impl Sync for PositiveInt
impl Unpin for PositiveInt
impl UnsafeUnpin for PositiveInt
impl UnwindSafe for PositiveInt
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.