pub struct Restriction {
pub base: String,
pub enumeration: Vec<String>,
pub patterns: Vec<String>,
pub min_inclusive: Option<String>,
pub max_inclusive: Option<String>,
pub min_exclusive: Option<String>,
pub max_exclusive: Option<String>,
pub length: Option<u64>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub total_digits: Option<u64>,
pub fraction_digits: Option<u64>,
}Expand description
An <xs:restriction> and its constraining facets.
Facet values stay in the lexical form the document wrote: whether
"2.50" is a number depends on base and on what it is compared with,
which is an audit decision.
Within one restriction, several enumerations are alternatives and so
are several patterns, as in XML Schema.
Fields§
§base: StringThe local name of the XML Schema built-in type in @base, e.g.
string for xs:string. The prefix is resolved, so xsd:string is
string too.
enumeration: Vec<String><xs:enumeration> values.
patterns: Vec<String><xs:pattern> values: XML Schema regular expressions, which match the
whole value (they are implicitly anchored).
min_inclusive: Option<String><xs:minInclusive>.
max_inclusive: Option<String><xs:maxInclusive>.
min_exclusive: Option<String><xs:minExclusive>.
max_exclusive: Option<String><xs:maxExclusive>.
length: Option<u64><xs:length>.
min_length: Option<u64><xs:minLength>.
max_length: Option<u64><xs:maxLength>.
total_digits: Option<u64><xs:totalDigits>.
fraction_digits: Option<u64><xs:fractionDigits>.
Implementations§
Source§impl Restriction
impl Restriction
Sourcepub fn new(base: impl Into<String>) -> Restriction
pub fn new(base: impl Into<String>) -> Restriction
A restriction of base without facets, e.g. Restriction::new("string").
Add at least one facet before writing; a restriction without facets is refused.
Sourcepub fn enumeration<I, S>(values: I) -> Restriction
pub fn enumeration<I, S>(values: I) -> Restriction
An xs:string restriction to one of values.
Sourcepub fn pattern(pattern: impl Into<String>) -> Restriction
pub fn pattern(pattern: impl Into<String>) -> Restriction
An xs:string restriction to an XML Schema regular expression.