Skip to main content

PatternFacet

Struct PatternFacet 

Source
pub struct PatternFacet {
    pub value: String,
    pub source: Option<SourceRef>,
    /* private fields */
}
Expand description

Pattern facet (regex constraint)

Fields§

§value: String

The pattern string (XSD regex syntax)

§source: Option<SourceRef>

Implementations§

Source§

impl PatternFacet

Source

pub fn new( value: String, source: Option<SourceRef>, xsd_version: XsdVersion, regex_compat: RegexCompat, ) -> FacetResult<Self>

Create a new pattern facet from an XSD pattern string.

The pattern is validated and compiled using the appropriate backend (XSD 1.0: regex via convert_xml_pattern; XSD 1.1: regexml after a \p{X} rewrite if xsd_version == V1_0). Returns an error if the pattern is invalid.

xsd_version controls the \p{X} category escape semantics: under V1_0 recognized general-category names are expanded to Unicode 3.0 ranges; V1_1 passes them through to the backend unchanged.

regex_compat controls grammar leniency: Strict enforces XSD Part 2 §F/§G; LenientMs first applies lenient_ms_preprocess to drop start/end anchors and (?#…) comments common in .NET-authored schemas.

Source

pub fn new_unchecked(value: String, source: Option<SourceRef>) -> Self

Create a pattern facet without compiling (for deferred compilation)

Source

pub fn compile( &mut self, xsd_version: XsdVersion, regex_compat: RegexCompat, ) -> FacetResult<()>

Compile the pattern if not already compiled

Source

pub fn matches(&self, value: &str) -> bool

Test if a value matches this pattern

Trait Implementations§

Source§

impl Clone for PatternFacet

Source§

fn clone(&self) -> PatternFacet

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 PatternFacet

Source§

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

Formats the value using the given formatter. Read more

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> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.