pub struct ParseOptions {
pub max_size: NonZeroUsize,
pub max_depth: NonZeroUsize,
pub validate: bool,
}
Expand description
Configuration options for parsing operations.
Provides fine-grained control over parsing behaviour and security limits.
Fields§
§max_size: NonZeroUsize
Maximum allowed content size
max_depth: NonZeroUsize
Maximum allowed nesting depth
validate: bool
Whether to validate content structure
Implementations§
Source§impl ParseOptions
impl ParseOptions
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load options from environment variables or use defaults.
Reads the following environment variables:
MAX_FRONTMATTER_SIZE
: Maximum size for frontmatter content.MAX_NESTING_DEPTH
: Maximum allowed nesting depth.VALIDATE_STRUCTURE
: Enable or disable structure validation (default:true
).
§Example
use frontmatter_gen::ParseOptions;
std::env::set_var("MAX_FRONTMATTER_SIZE", "2048");
std::env::set_var("MAX_NESTING_DEPTH", "64");
let options = ParseOptions::from_env();
assert_eq!(options.max_size.get(), 2048);
assert_eq!(options.max_depth.get(), 64);
assert!(options.validate);
Trait Implementations§
Source§impl Clone for ParseOptions
impl Clone for ParseOptions
Source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
Returns a copy 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 ParseOptions
impl Debug for ParseOptions
Source§impl Default for ParseOptions
impl Default for ParseOptions
impl Copy for ParseOptions
Auto Trait Implementations§
impl Freeze for ParseOptions
impl RefUnwindSafe for ParseOptions
impl Send for ParseOptions
impl Sync for ParseOptions
impl Unpin for ParseOptions
impl UnwindSafe for ParseOptions
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