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

👎 Deprecated since 0.4.0:

use the Default trait implementation instead

Constructs default lexer options.

The defaults are implementation-defined and should not be relied upon.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Constructs default lexer options.

The defaults are implementation-defined and should not be relied upon.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.