pub struct Field {
pub label: String,
pub ty: FieldType,
pub min: usize,
pub max: Option<usize>,
}Expand description
One named, cardinality-bound field slot of a record: label of type,
occurring [min, max] times (max = None is unbounded).
Fields§
§label: StringThe label of the field.
ty: FieldTypeThe field’s type.
min: usizeMinimum occurrence count required.
max: Option<usize>Maximum occurrence count allowed (None indicates unbounded cardinality).
Implementations§
Source§impl Field
impl Field
Sourcepub fn new(
label: impl Into<String>,
ty: impl Into<FieldType>,
min: usize,
max: Option<usize>,
) -> Result<Self, SchemaError>
pub fn new( label: impl Into<String>, ty: impl Into<FieldType>, min: usize, max: Option<usize>, ) -> Result<Self, SchemaError>
Construct a new Field with label, type, and cardinality bounds [min, max] (spec §3, §3.3).
Sourcepub fn required(
label: impl Into<String>,
ty: impl Into<FieldType>,
) -> Result<Self, SchemaError>
pub fn required( label: impl Into<String>, ty: impl Into<FieldType>, ) -> Result<Self, SchemaError>
A required, exactly-once field ([1,1]) – the common case.
Sourcepub fn cardinality_str(&self) -> String
pub fn cardinality_str(&self) -> String
Human-readable description of this field’s cardinality bounds.
Trait Implementations§
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more