Struct refined_type::Refined
source · 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().deref(), "Hello World");
let empty_string_result = Refined::<NonEmptyStringRule>::new("".to_string());
assert!(empty_string_result.is_err())Implementations§
Trait Implementations§
source§impl<RULE> PartialEq for Refined<RULE>
impl<RULE> PartialEq for Refined<RULE>
impl<RULE> Eq for Refined<RULE>
impl<RULE> StructuralPartialEq for Refined<RULE>where
RULE: Rule,
Auto Trait Implementations§
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