pub struct Refined<RULE>where
RULE: Rule,{ /* private fields */ }Expand description
Refined is a versatile type in ensuring that T satisfies the conditions of RULE (predicate type)
§Example
use refined_type::rule::{NonEmptyString, NonEmptyStringRule};
use refined_type::Refined;
let non_empty_string_result = Refined::<NonEmptyStringRule>::new("Hello World".to_string());
assert_eq!(non_empty_string_result.unwrap().into_value(), "Hello World");
let empty_string_result = Refined::<NonEmptyStringRule>::new("".to_string());
assert!(empty_string_result.is_err())Implementations§
Source§impl<K, V, S> Refined<Not<EmptyRule<HashMap<K, V, S>>>>
impl<K, V, S> Refined<Not<EmptyRule<HashMap<K, V, S>>>>
pub fn into_iter(self) -> NonEmpty<IntoIter<K, V>>
pub fn iter(&self) -> NonEmpty<Iter<'_, K, V>>
pub fn hasher(&self) -> &S
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn keys(&self) -> Keys<'_, K, V>
pub fn into_keys(self) -> IntoKeys<K, V>
pub fn values(&self) -> Values<'_, K, V>
pub fn into_values(self) -> IntoValues<K, V>
Source§impl<T, S> Refined<Not<EmptyRule<HashSet<T, S>>>>
impl<T, S> Refined<Not<EmptyRule<HashSet<T, S>>>>
Source§impl Refined<Not<EmptyRule<String>>>
impl Refined<Not<EmptyRule<String>>>
pub fn insert(self, idx: usize, ch: char) -> Self
pub fn push(self, ch: char) -> Self
pub fn push_str(self, string: &str) -> Self
pub fn as_bytes(&self) -> NonEmptyVec<u8>
pub fn repeat(&self, n: usize) -> Self
pub fn to_ascii_lowercase(&self) -> Self
pub fn to_lowercase(&self) -> Self
pub fn to_ascii_uppercase(&self) -> Self
pub fn to_uppercase(&self) -> Self
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
Source§impl<T> Refined<Not<EmptyRule<VecDeque<T>>>>
impl<T> Refined<Not<EmptyRule<VecDeque<T>>>>
pub fn into_iter(self) -> NonEmpty<IntoIter<T>>
pub fn iter(&self) -> NonEmpty<Iter<'_, T>>
pub fn get(&self, index: usize) -> Option<&T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn push_front(self, value: T) -> Self
pub fn push_back(self, value: T) -> Self
Source§impl<I: Debug + ExactSizeIterator + EmptyDefinition> Refined<Not<EmptyRule<I>>>
impl<I: Debug + ExactSizeIterator + EmptyDefinition> Refined<Not<EmptyRule<I>>>
Trait Implementations§
Source§impl<'de, RULE, T> Deserialize<'de> for Refined<RULE>where
RULE: Rule<Item = T>,
T: Deserialize<'de>,
impl<'de, RULE, T> Deserialize<'de> for Refined<RULE>where
RULE: Rule<Item = T>,
T: Deserialize<'de>,
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<RULE> Ord for Refined<RULE>
impl<RULE> Ord for Refined<RULE>
1.21.0 · 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<RULE> PartialOrd for Refined<RULE>
impl<RULE> PartialOrd for Refined<RULE>
impl<RULE> Eq for Refined<RULE>
impl<RULE> StructuralPartialEq for Refined<RULE>where
RULE: Rule,
Auto Trait Implementations§
impl<RULE> Freeze for Refined<RULE>
impl<RULE> RefUnwindSafe for Refined<RULE>
impl<RULE> Send for Refined<RULE>
impl<RULE> Sync for Refined<RULE>
impl<RULE> Unpin for Refined<RULE>
impl<RULE> UnwindSafe for Refined<RULE>
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