[−][src]Struct sudoku_backend::ops::constraints::HexString
Require that the string be hexadecimal and of the specified width.
The error type can be deconstructed as:
Some(Some(len))
⇒ supplied string has invalidlen
gthSome(None)
⇒ supplied string contains non-hexadecimal charactersNone
⇒ supplied string coudln't be decoded
Examples
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct TestLength; impl StringLength for TestLength { const LENGTH: usize = 8; } assert_eq!(HexString::<TestLength>::from_str("0a1B3c4D"), Ok(HexString("0a1B3c4D".to_string(), PhantomData))); assert!(HexString::<TestLength>::from_str("0a1B3c4").is_err()); assert!(HexString::<TestLength>::from_str("0a1B3c4D5").is_err()); assert!(HexString::<TestLength>::from_str("Давай по").is_err());
Trait Implementations
impl<P: PartialEq + StringLength> PartialEq<HexString<P>> for HexString<P>
[src]
impl<P: PartialEq + StringLength> PartialEq<HexString<P>> for HexString<P>
impl<P: Clone + StringLength> Clone for HexString<P>
[src]
impl<P: Clone + StringLength> Clone for HexString<P>
fn clone(&self) -> HexString<P>
[src]
fn clone(&self) -> HexString<P>
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<P: Ord + StringLength> Ord for HexString<P>
[src]
impl<P: Ord + StringLength> Ord for HexString<P>
fn cmp(&self, other: &HexString<P>) -> Ordering
[src]
fn cmp(&self, other: &HexString<P>) -> 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<P: Eq + StringLength> Eq for HexString<P>
[src]
impl<P: Eq + StringLength> Eq for HexString<P>
impl<P: PartialOrd + StringLength> PartialOrd<HexString<P>> for HexString<P>
[src]
impl<P: PartialOrd + StringLength> PartialOrd<HexString<P>> for HexString<P>
fn partial_cmp(&self, other: &HexString<P>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &HexString<P>) -> Option<Ordering>
fn lt(&self, other: &HexString<P>) -> bool
[src]
fn lt(&self, other: &HexString<P>) -> bool
fn le(&self, other: &HexString<P>) -> bool
[src]
fn le(&self, other: &HexString<P>) -> bool
fn gt(&self, other: &HexString<P>) -> bool
[src]
fn gt(&self, other: &HexString<P>) -> bool
fn ge(&self, other: &HexString<P>) -> bool
[src]
fn ge(&self, other: &HexString<P>) -> bool
impl<P: Debug + StringLength> Debug for HexString<P>
[src]
impl<P: Debug + StringLength> Debug for HexString<P>
impl<P: StringLength> FromStr for HexString<P>
[src]
impl<P: StringLength> FromStr for HexString<P>
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<P: Hash + StringLength> Hash for HexString<P>
[src]
impl<P: Hash + StringLength> Hash for HexString<P>
fn hash<__HP: Hasher>(&self, state: &mut __HP)
[src]
fn hash<__HP: Hasher>(&self, state: &mut __HP)
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<P: StringLength> Serialize for HexString<P>
[src]
impl<P: StringLength> Serialize for HexString<P>
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, P: StringLength> Deserialize<'de> for HexString<P>
[src]
impl<'de, P: StringLength> Deserialize<'de> for HexString<P>
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, P: StringLength> FromFormValue<'v> for HexString<P>
[src]
impl<'v, P: StringLength> FromFormValue<'v> for HexString<P>
type Error = Option<Option<usize>>
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