#[non_exhaustive]pub struct Options<'a> {
pub safe_mode: SafeMode,
pub timings: bool,
pub include_loader: IncludeLoader,
pub base_dir: Option<PathBuf>,
pub strict: bool,
/* private fields */
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.safe_mode: SafeModeDefaults to SafeMode::Secure, which prevents include reads.
timings: bool§include_loader: IncludeLoaderSelects how the parser loads include sources.
Defaults to IncludeLoader::System, subject to safe_mode. Set
IncludeLoader::Disabled to preserve directives in modes below Secure.
base_dir: Option<PathBuf>Directory used to resolve relative includes from the entry input.
Only consulted when include loading is enabled. String and reader input default to the current working directory. File input normally uses the entry file’s parent, unless this value overrides it. In Safe and Server modes this directory is also the local-include boundary.
strict: boolReject a manpage title that does not use the name(volume) form.
This does not promote all warnings to errors. Use
crate::ParseResult::source_recovery to detect recovered content.
Implementations§
Source§impl<'a> Options<'a>
impl<'a> Options<'a>
Sourcepub fn builder() -> OptionsBuilder<'a>
pub fn builder() -> OptionsBuilder<'a>
Create a new OptionsBuilder for fluent configuration.
§Example
use acdc_parser::{Options, SafeMode};
let options = Options::builder()
.with_safe_mode(SafeMode::Safe)
.with_timings()
.with_attribute("toc", "left")
.build()?;Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Options with default settings.
Equivalent to Options::default().
Sourcepub fn with_attributes<N, V>(
attributes: impl IntoIterator<Item = (N, V)>,
) -> Result<Self, Error>
pub fn with_attributes<N, V>( attributes: impl IntoIterator<Item = (N, V)>, ) -> Result<Self, Error>
Create options from application-supplied attributes.
§Errors
Returns a structured error for an invalid attribute value.
Sourcepub const fn document_attributes(&self) -> &DocumentAttributes<'a>
pub const fn document_attributes(&self) -> &DocumentAttributes<'a>
Return the validated attributes configured for parsing.
Sourcepub fn max_total_include_bytes(&self) -> usize
pub fn max_total_include_bytes(&self) -> usize
Maximum selected include text per parse, in bytes. Defaults to 64 MiB.
See OptionsBuilder::with_max_total_include_bytes for what counts.
Sourcepub fn into_document_attributes(self) -> DocumentAttributes<'a>
pub fn into_document_attributes(self) -> DocumentAttributes<'a>
Consume the options and return their validated attribute collection.
Sourcepub fn with_document_attributes(
self,
attributes: DocumentAttributes<'a>,
) -> Self
pub fn with_document_attributes( self, attributes: DocumentAttributes<'a>, ) -> Self
Replace the attribute snapshot with one from an already parsed document.
This does not reclassify or revalidate assignments. Use the builder when supplied values should become new application overrides.
Sourcepub fn into_builder(self) -> OptionsBuilder<'a>
pub fn into_builder(self) -> OptionsBuilder<'a>
Reopen configuration while preserving application overrides and defaults.
Sourcepub fn into_static(self) -> Options<'static>
pub fn into_static(self) -> Options<'static>
Consume the options, producing an independent 'static copy.