pub struct TextSchema {
pub language: Option<String>,
pub min_length: Option<u32>,
pub max_length: Option<u32>,
pub pattern: Option<Regex>,
pub unknown_fields: IndexMap<String, NodeId>,
}Expand description
Text type constraints
The language field determines what kind of text is expected:
None- accepts any text (no language constraint)Some("plaintext")- expects plaintext (from"..."syntax orLanguage::Plaintext)Some("rust")- expects Rust code (fromrust`...`syntax orLanguage::Other("rust"))
§Schema Syntax
.text- any text (language=None).text.X- text with language X (e.g.,.text.rust,.text.email)
§Validation Rules
When validating a Text value against a TextSchema:
Language::Plaintextmatches schema withlanguage=Noneorlanguage=Some("plaintext")Language::Implicitmatches any schema (the schema’s language is applied)Language::Other(lang)matches schema withlanguage=Noneorlanguage=Some(lang)
@variants.text
language = .text (optional) # e.g., "rust", "email", "markdown"
min-length = .integer (optional)
max-length = .integer (optional)
pattern = .text (optional)Fields§
§language: Option<String>Language identifier (e.g., “rust”, “javascript”, “email”, “plaintext”)
None- accepts any text regardless of languageSome(lang)- expects text with the specific language tag
Note: When a value has Language::Implicit (from `...` syntax),
it can be coerced to match the schema’s expected language.
min_length: Option<u32>Minimum length constraint (in UTF-8 code points)
max_length: Option<u32>Maximum length constraint (in UTF-8 code points)
pattern: Option<Regex>Regex pattern constraint (applied to the text content). Pre-compiled at schema parse time for efficiency.
unknown_fields: IndexMap<String, NodeId>Unknown fields (for future extensions like “flatten”)
Trait Implementations§
Source§impl Clone for TextSchema
impl Clone for TextSchema
Source§fn clone(&self) -> TextSchema
fn clone(&self) -> TextSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextSchema
impl Debug for TextSchema
Source§impl Default for TextSchema
impl Default for TextSchema
Source§fn default() -> TextSchema
fn default() -> TextSchema
Returns the “default value” for a type. Read more
Source§impl<'doc> FromEure<'doc> for TextSchema
impl<'doc> FromEure<'doc> for TextSchema
Source§type Error = ParseError
type Error = ParseError
The error type returned by parsing.
Source§impl PartialEq for TextSchema
impl PartialEq for TextSchema
Auto Trait Implementations§
impl Freeze for TextSchema
impl RefUnwindSafe for TextSchema
impl Send for TextSchema
impl Sync for TextSchema
impl Unpin for TextSchema
impl UnwindSafe for TextSchema
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