pub struct PatternFacet {
pub value: String,
pub source: Option<SourceRef>,
/* private fields */
}Expand description
Pattern facet (regex constraint)
Fields§
§value: StringThe pattern string (XSD regex syntax)
source: Option<SourceRef>Implementations§
Source§impl PatternFacet
impl PatternFacet
Sourcepub fn new(
value: String,
source: Option<SourceRef>,
xsd_version: XsdVersion,
regex_compat: RegexCompat,
) -> FacetResult<Self>
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.
Sourcepub fn new_unchecked(value: String, source: Option<SourceRef>) -> Self
pub fn new_unchecked(value: String, source: Option<SourceRef>) -> Self
Create a pattern facet without compiling (for deferred compilation)
Sourcepub fn compile(
&mut self,
xsd_version: XsdVersion,
regex_compat: RegexCompat,
) -> FacetResult<()>
pub fn compile( &mut self, xsd_version: XsdVersion, regex_compat: RegexCompat, ) -> FacetResult<()>
Compile the pattern if not already compiled
Trait Implementations§
Source§impl Clone for PatternFacet
impl Clone for PatternFacet
Source§fn clone(&self) -> PatternFacet
fn clone(&self) -> PatternFacet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more