pub struct DependencySpec { /* private fields */ }Expand description
Describes one ordered dependency slot supplied to a validator.
§Examples
use qubit_validator::{DependencySpec, InputType};
let dependency = DependencySpec::new("credential", InputType::Text, false);
assert_eq!(dependency.name(), "credential");
assert!(!dependency.optional());Implementations§
Source§impl DependencySpec
impl DependencySpec
Sourcepub const fn new(name: &'static str, input: InputType, optional: bool) -> Self
pub const fn new(name: &'static str, input: InputType, optional: bool) -> Self
Creates a dependency declaration.
§Parameters
name: non-empty logical slot name used in diagnostics.input: erased value shape required by the slot.optional: whether an explicit missing value is accepted.
§Returns
Returns a declaration containing the supplied dependency metadata.
§Panics
Panics when name is empty.
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];More examples
Sourcepub const fn optional(self) -> bool
pub const fn optional(self) -> bool
Returns whether an explicit missing value is accepted.
§Returns
Returns true when the dependency accepts
super::ValidationValue::Missing.
Trait Implementations§
Source§impl Clone for DependencySpec
impl Clone for DependencySpec
impl Copy for DependencySpec
Source§impl Debug for DependencySpec
impl Debug for DependencySpec
impl Eq for DependencySpec
Source§impl PartialEq for DependencySpec
impl PartialEq for DependencySpec
impl StructuralPartialEq for DependencySpec
Auto Trait Implementations§
impl Forget for DependencySpec
impl Freeze for DependencySpec
impl Move for DependencySpec
impl RefUnwindSafe for DependencySpec
impl Send for DependencySpec
impl Sync for DependencySpec
impl Unpin for DependencySpec
impl UnsafeUnpin for DependencySpec
impl UnwindSafe for DependencySpec
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