pub struct TextSpec {
pub name: &'static str,
pub min: usize,
pub max: usize,
pub charset: Charset,
pub ws: Ws,
pub pattern: Option<Shape>,
}Expand description
The lexical rules of one schema type.
Fields§
§name: &'static strThe type’s name in errors.
min: usizeMinimum length in characters.
max: usizeMaximum length in characters.
charset: CharsetThe permitted characters.
ws: WsThe whitespace facet.
pattern: Option<Shape>An extra shape check and its description, for patterned types.
Implementations§
Source§impl TextSpec
impl TextSpec
Sourcepub const fn xml(name: &'static str, min: usize, max: usize) -> Self
pub const fn xml(name: &'static str, min: usize, max: usize) -> Self
A length-only xsd:string restriction: XML characters, whitespace preserved.
Sourcepub fn parse(&self, input: &str) -> Result<String, ValueError>
pub fn parse(&self, input: &str) -> Result<String, ValueError>
Normalises whitespace as the facet says, then checks characters, length and shape.
§Errors
ValueError naming the first violated facet.
Trait Implementations§
Auto Trait Implementations§
impl Forget for TextSpec
impl Freeze for TextSpec
impl Move for TextSpec
impl RefUnwindSafe for TextSpec
impl Send for TextSpec
impl Sync for TextSpec
impl Unpin for TextSpec
impl UnsafeUnpin for TextSpec
impl UnwindSafe for TextSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more