#[non_exhaustive]pub enum InputType {
Text,
Typed(TypeId),
}Expand description
The two intentionally small input views used by the validation boundary.
§Examples
use qubit_validator::{InputType, ValidationValue};
assert!(InputType::Text.accepts(ValidationValue::Text("hello")));
assert!(InputType::of::<u32>().accepts(ValidationValue::Typed(&3_u32)));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl InputType
impl InputType
Sourcepub const fn of<T: 'static>() -> Self
pub const fn of<T: 'static>() -> Self
Creates a typed input descriptor for T.
§Type Parameters
T: Exact concrete input type; it must be'staticforTypeId.
§Returns
A descriptor that accepts only values whose concrete type is T.
Examples found in repository?
examples/validate_named_bench.rs (line 53)
53static D1: &[DependencySpec] = &[DependencySpec::new("a", InputType::of::<u64>(), false)];
54static D4: &[DependencySpec] = &[
55 DependencySpec::new("a", InputType::of::<u64>(), false),
56 DependencySpec::new("b", InputType::of::<u64>(), false),
57 DependencySpec::new("c", InputType::of::<u64>(), false),
58 DependencySpec::new("d", InputType::of::<u64>(), false),
59];
60static D8: &[DependencySpec] = &[
61 DependencySpec::new("a", InputType::of::<u64>(), false),
62 DependencySpec::new("b", InputType::of::<u64>(), false),
63 DependencySpec::new("c", InputType::of::<u64>(), false),
64 DependencySpec::new("d", InputType::of::<u64>(), false),
65 DependencySpec::new("e", InputType::of::<u64>(), false),
66 DependencySpec::new("f", InputType::of::<u64>(), false),
67 DependencySpec::new("g", InputType::of::<u64>(), false),
68 DependencySpec::new("h", InputType::of::<u64>(), false),
69];
70static D9: &[DependencySpec] = &[
71 DependencySpec::new("a", InputType::of::<u64>(), false),
72 DependencySpec::new("b", InputType::of::<u64>(), false),
73 DependencySpec::new("c", InputType::of::<u64>(), false),
74 DependencySpec::new("d", InputType::of::<u64>(), false),
75 DependencySpec::new("e", InputType::of::<u64>(), false),
76 DependencySpec::new("f", InputType::of::<u64>(), false),
77 DependencySpec::new("g", InputType::of::<u64>(), false),
78 DependencySpec::new("h", InputType::of::<u64>(), false),
79 DependencySpec::new("i", InputType::of::<u64>(), false),
80];Trait Implementations§
impl Copy for InputType
impl Eq for InputType
impl StructuralPartialEq for InputType
Auto Trait Implementations§
impl Forget for InputType
impl Freeze for InputType
impl Move for InputType
impl RefUnwindSafe for InputType
impl Send for InputType
impl Sync for InputType
impl Unpin for InputType
impl UnsafeUnpin for InputType
impl UnwindSafe for InputType
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