Struct rxml::LexerOptions
source · [−]pub struct LexerOptions {
pub max_token_length: usize,
}
Expand description
Hold options to configure a Lexer
.
See also Lexer::with_options()
.
Fields
max_token_length: usize
Maximum number of bytes which can form a token.
This exists to limit the memory use of the Lexer for tokens where the
data needs to be buffered in memory (most notably
Token::Text
and Token::AttributeValue
).
If token data exceeds this limit, it depends on the token type whether
a partial token is emitted or the lexing fails with
Error::RestrictedXml
: Text tokens are
split and emitted in parts (and lexing continues), all other tokens
exceeding this limit will cause an error.
Implementations
sourceimpl LexerOptions
impl LexerOptions
sourcepub fn defaults() -> LexerOptions
👎 Deprecated since 0.4.0: use the Default trait implementation instead
pub fn defaults() -> LexerOptions
use the Default trait implementation instead
Constructs default lexer options.
The defaults are implementation-defined and should not be relied upon.
sourcepub fn max_token_length(self, v: usize) -> LexerOptions
pub fn max_token_length(self, v: usize) -> LexerOptions
Set the LexerOptions::max_token_length
value.
Example
use rxml::{Lexer, LexerOptions};
let mut lexer = Lexer::with_options(LexerOptions::default().max_token_length(1024));
Trait Implementations
sourceimpl Clone for LexerOptions
impl Clone for LexerOptions
sourcefn clone(&self) -> LexerOptions
fn clone(&self) -> LexerOptions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for LexerOptions
impl Debug for LexerOptions
sourceimpl Default for LexerOptions
impl Default for LexerOptions
sourceimpl PartialEq<LexerOptions> for LexerOptions
impl PartialEq<LexerOptions> for LexerOptions
sourcefn eq(&self, other: &LexerOptions) -> bool
fn eq(&self, other: &LexerOptions) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &LexerOptions) -> bool
fn ne(&self, other: &LexerOptions) -> bool
This method tests for !=
.
impl Copy for LexerOptions
impl StructuralPartialEq for LexerOptions
Auto Trait Implementations
impl RefUnwindSafe for LexerOptions
impl Send for LexerOptions
impl Sync for LexerOptions
impl Unpin for LexerOptions
impl UnwindSafe for LexerOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more