Skip to main content

Restriction

Struct Restriction 

Source
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: String

The 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

Source

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.

Source

pub fn enumeration<I, S>(values: I) -> Restriction
where I: IntoIterator<Item = S>, S: Into<String>,

An xs:string restriction to one of values.

Source

pub fn pattern(pattern: impl Into<String>) -> Restriction

An xs:string restriction to an XML Schema regular expression.

Trait Implementations§

Source§

impl Clone for Restriction

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 Debug for Restriction

Source§

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

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

impl Default for Restriction

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Restriction

Source§

impl From<Restriction> for Value

Source§

fn from(restriction: Restriction) -> Value

Converts to this type from the input type.
Source§

impl PartialEq for Restriction

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 Restriction

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> 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.