Skip to main content

Constraint

Enum Constraint 

Source
pub enum Constraint {
Show 19 variants MinCount(u32), MaxCount(u32), Datatype(&'static str), NodeKind(NodeKind), Class(&'static [&'static str]), In(&'static [&'static str]), HasValue(&'static str), MaxLength(u32), MinLength(u32), RefClass(&'static [&'static str]), MinInclusive(f64), MaxInclusive(f64), MinExclusive(f64), MaxExclusive(f64), LessThan(&'static str), LessThanOrEquals(&'static str), NotClass(&'static [&'static str]), QualifiedIn { allowed: &'static [&'static str], min: u32, }, Length(u32),
}
Expand description

A single check on the values a Path yields.

Variants§

§

MinCount(u32)

§

MaxCount(u32)

§

Datatype(&'static str)

The xsd type’s local name ("integer", "dateTime", …). A bag holds strings, so this is a real parse check rather than the tautology it was against a typed struct.

§

NodeKind(NodeKind)

§

Class(&'static [&'static str])

sh:class — the referenced element must be an instance of this family-qualified class, or a descendant of it. Already expanded, so the check is a set membership.

§

In(&'static [&'static str])

sh:in — the value must be one of these. Enum IRIs are stored as the decoder stores them: fragment only.

§

HasValue(&'static str)

sh:hasValue, and sh:in with exactly one member after simplification.

§

MaxLength(u32)

§

MinLength(u32)

§

RefClass(&'static [&'static str])

The referenced element’s class must be one of these family-qualified names. Produced by sh:in on a path ending in rdf:type.

Only checked when the referenced element is present. Phase-1 validation runs per file, so a reference out of the current file is normal and is a different rule’s business — reporting it here would make every cross-file association a value-type violation.

§

MinInclusive(f64)

sh:minInclusive and friends. Compared as f64; a value that does not parse as a number is skipped, the way a typed numeric field that failed to parse is None — malformed numbers are sh:datatype’s business.

§

MaxInclusive(f64)

§

MinExclusive(f64)

§

MaxExclusive(f64)

§

LessThan(&'static str)

sh:lessThan — this property’s value must be below the named field’s on the same element. Only checked when both are present and numeric.

§

LessThanOrEquals(&'static str)

§

NotClass(&'static [&'static str])

sh:not [ sh:class X ] — the referenced element must not be an instance of these family-qualified classes. Silent when the referenced element is absent, like Constraint::Class.

§

QualifiedIn

sh:qualifiedValueShape [ sh:in (..) ] with sh:qualifiedMinCount — at least min values must be among allowed. NCP uses it to ask whether a dataset declares conformance to one of a set of profiles.

Fields

§allowed: &'static [&'static str]
§min: u32
§

Length(u32)

sh:length — exactly this many characters, e.g. the 16 of an EIC code.

Trait Implementations§

Source§

impl Clone for Constraint

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Constraint

Source§

impl Debug for Constraint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Constraint

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Constraint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.