[−][src]Struct sudoku_backend::ops::constraints::Positive
Weakly validate the int to be positive.
The error type can be deconstructed as:
Some(err)
⇒ number parsing failed due to the specifiederr
orNone
⇒ number nonpositive
Examples
assert_eq!(Positive::<i32>::from_str("12"), Ok(Positive(12))); assert_eq!(Positive::<f64>::from_str("0.8113"), Ok(Positive(0.8113))); assert!(Positive::<i32>::from_str("hi").is_err()); assert!(Positive::<i32>::from_str("0").is_err()); assert!(Positive::<f64>::from_str("-123").is_err());
Trait Implementations
impl<T: PartialEq + FromStr + From<i32> + PartialOrd> PartialEq<Positive<T>> for Positive<T>
[src]
impl<T: PartialEq + FromStr + From<i32> + PartialOrd> PartialEq<Positive<T>> for Positive<T>
impl<T: Clone + FromStr + From<i32> + PartialOrd> Clone for Positive<T>
[src]
impl<T: Clone + FromStr + From<i32> + PartialOrd> Clone for Positive<T>
fn clone(&self) -> Positive<T>
[src]
fn clone(&self) -> Positive<T>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Copy + FromStr + From<i32> + PartialOrd> Copy for Positive<T>
[src]
impl<T: Copy + FromStr + From<i32> + PartialOrd> Copy for Positive<T>
impl<T: Ord + FromStr + From<i32> + PartialOrd> Ord for Positive<T>
[src]
impl<T: Ord + FromStr + From<i32> + PartialOrd> Ord for Positive<T>
fn cmp(&self, other: &Positive<T>) -> Ordering
[src]
fn cmp(&self, other: &Positive<T>) -> Ordering
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: Eq + FromStr + From<i32> + PartialOrd> Eq for Positive<T>
[src]
impl<T: Eq + FromStr + From<i32> + PartialOrd> Eq for Positive<T>
impl<T: PartialOrd + FromStr + From<i32> + PartialOrd> PartialOrd<Positive<T>> for Positive<T>
[src]
impl<T: PartialOrd + FromStr + From<i32> + PartialOrd> PartialOrd<Positive<T>> for Positive<T>
fn partial_cmp(&self, other: &Positive<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Positive<T>) -> Option<Ordering>
fn lt(&self, other: &Positive<T>) -> bool
[src]
fn lt(&self, other: &Positive<T>) -> bool
fn le(&self, other: &Positive<T>) -> bool
[src]
fn le(&self, other: &Positive<T>) -> bool
fn gt(&self, other: &Positive<T>) -> bool
[src]
fn gt(&self, other: &Positive<T>) -> bool
fn ge(&self, other: &Positive<T>) -> bool
[src]
fn ge(&self, other: &Positive<T>) -> bool
impl<T: Debug + FromStr + From<i32> + PartialOrd> Debug for Positive<T>
[src]
impl<T: Debug + FromStr + From<i32> + PartialOrd> Debug for Positive<T>
impl<T: FromStr + From<i32> + PartialOrd> FromStr for Positive<T> where
<T as FromStr>::Err: ToString,
[src]
impl<T: FromStr + From<i32> + PartialOrd> FromStr for Positive<T> where
<T as FromStr>::Err: ToString,
type Err = Self::Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
fn from_str(s: &str) -> Result<Self, Self::Err>
impl<T: Hash + FromStr + From<i32> + PartialOrd> Hash for Positive<T>
[src]
impl<T: Hash + FromStr + From<i32> + PartialOrd> Hash for Positive<T>
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: FromStr + From<i32> + PartialOrd> Serialize for Positive<T> where
T: Serialize,
[src]
impl<T: FromStr + From<i32> + PartialOrd> Serialize for Positive<T> where
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
impl<'de, T: FromStr + From<i32> + PartialOrd> Deserialize<'de> for Positive<T> where
T: Deserialize<'de>,
[src]
impl<'de, T: FromStr + From<i32> + PartialOrd> Deserialize<'de> for Positive<T> where
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
impl<'v, T: FromStr + From<i32> + PartialOrd> FromFormValue<'v> for Positive<T> where
<T as FromStr>::Err: ToString,
[src]
impl<'v, T: FromStr + From<i32> + PartialOrd> FromFormValue<'v> for Positive<T> where
<T as FromStr>::Err: ToString,
type Error = Option<String>
The associated error which can be returned from parsing. It is a good idea to have the return type be or contain an &'v str
so that the unparseable string can be examined after a bad parse. Read more
fn from_form_value(form_value: &'v RawStr) -> Result<Self, Self::Error>
[src]
fn from_form_value(form_value: &'v RawStr) -> Result<Self, Self::Error>
fn default() -> Option<Self>
[src]
fn default() -> Option<Self>
Returns a default value to be used when the form field does not exist. If this returns None
, then the field is required. Otherwise, this should return Some(default_value)
. The default implementation simply returns None
. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,
impl<T> IntoSql for T
[src]
impl<T> IntoSql for T
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self
to an expression for Diesel's query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel's query builder. Read more