[][src]Struct sudoku_backend::ops::constraints::Positive

pub struct Positive<T: FromStr + From<i32> + PartialOrd>(pub T);

Weakly validate the int to be positive.

The error type can be deconstructed as:

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: Clone + FromStr + From<i32> + PartialOrd> Clone for Positive<T>
[src]

Performs copy-assignment from source. Read more

impl<T: Copy + FromStr + From<i32> + PartialOrd> Copy for Positive<T>
[src]

impl<T: Ord + FromStr + From<i32> + PartialOrd> Ord for Positive<T>
[src]

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T: Eq + FromStr + From<i32> + PartialOrd> Eq for Positive<T>
[src]

impl<T: PartialOrd + FromStr + From<i32> + PartialOrd> PartialOrd<Positive<T>> for Positive<T>
[src]

impl<T: Debug + FromStr + From<i32> + PartialOrd> Debug for Positive<T>
[src]

impl<T: FromStr + From<i32> + PartialOrd> FromStr for Positive<T> where
    <T as FromStr>::Err: ToString
[src]

The associated error which can be returned from parsing.

impl<T: Hash + FromStr + From<i32> + PartialOrd> Hash for Positive<T>
[src]

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<'de, T: FromStr + From<i32> + PartialOrd> Deserialize<'de> for Positive<T> where
    T: Deserialize<'de>, 
[src]

impl<'v, T: FromStr + From<i32> + PartialOrd> FromFormValue<'v> for Positive<T> where
    <T as FromStr>::Err: ToString
[src]

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

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

impl<T> Send for Positive<T> where
    T: Send

impl<T> Sync for Positive<T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Typeable for T where
    T: Any
[src]

Get the TypeId of this object.

impl<T> IntoSql for T
[src]

Convert self to an expression for Diesel's query builder. Read more

Convert &self to an expression for Diesel's query builder. Read more