#[non_exhaustive]pub struct OptionsBuilder<'a> { /* private fields */ }Expand description
Builder for Options that provides an API for configuration.
Create an OptionsBuilder using Options::builder().
§Example
use acdc_parser::{Options, SafeMode};
let options = Options::builder()
.with_safe_mode(SafeMode::Safe)
.with_timings()
.with_attribute("toc", "left")
.with_attribute("sectnums", true)
.build()?;Implementations§
Source§impl<'a> OptionsBuilder<'a>
impl<'a> OptionsBuilder<'a>
Sourcepub fn with_safe_mode(self, safe_mode: SafeMode) -> Self
pub fn with_safe_mode(self, safe_mode: SafeMode) -> Self
Set the safe mode for parsing.
§Example
use acdc_parser::{Options, SafeMode};
let options = Options::builder()
.with_safe_mode(SafeMode::Safe)
.build()?;Sourcepub fn with_timings(self) -> Self
pub fn with_timings(self) -> Self
Enable timing information during parsing.
§Example
use acdc_parser::Options;
let options = Options::builder()
.with_timings()
.build()?;Sourcepub fn with_base_dir(self, base_dir: impl AsRef<Path>) -> Self
pub fn with_base_dir(self, base_dir: impl AsRef<Path>) -> Self
Set the directory used to resolve relative includes from the entry input.
For file input this overrides the entry file’s parent directory. Nested includes remain relative to the file that contains them.
Sourcepub fn with_strict(self) -> Self
pub fn with_strict(self) -> Self
Reject manpage titles that do not use the name(volume) form.
Other recoverable problems still produce warnings.
§Example
use acdc_parser::Options;
let options = Options::builder()
.with_strict()
.build()?;Sourcepub fn with_attribute(
self,
name: impl Into<Cow<'a, str>>,
value: impl Into<AttributeValue<'a>>,
) -> Self
pub fn with_attribute( self, name: impl Into<Cow<'a, str>>, value: impl Into<AttributeValue<'a>>, ) -> Self
Supply an application attribute.
Application values take precedence over document entries, subject to the attribute’s standard assignment rules.
This is a convenience method that accepts various types for the value:
&strbecomesAttributeValue::StringboolbecomesAttributeValue::Bool()becomesAttributeValue::None
§Example
use acdc_parser::Options;
let options = Options::builder()
.with_attribute("toc", "left")
.with_attribute("sectnums", true)
.build()?;Sourcepub fn with_attributes<N, V>(
self,
attributes: impl IntoIterator<Item = (N, V)>,
) -> Self
pub fn with_attributes<N, V>( self, attributes: impl IntoIterator<Item = (N, V)>, ) -> Self
Replace the application-supplied attributes.
Sourcepub fn with_defaults<N, V>(
self,
defaults: impl IntoIterator<Item = (N, V)>,
) -> Self
pub fn with_defaults<N, V>( self, defaults: impl IntoIterator<Item = (N, V)>, ) -> Self
Replace defaults for attributes not supplied by the application.
Document entries can replace these defaults when the attribute permits it. Intrinsic backend values retain their normal precedence. Backend, base backend, file type, and document type defaults also determine their convenience attributes when the options are built.
Sourcepub fn with_default_attribute(
self,
name: impl Into<Cow<'a, str>>,
value: impl Into<AttributeValue<'a>>,
) -> Self
pub fn with_default_attribute( self, name: impl Into<Cow<'a, str>>, value: impl Into<AttributeValue<'a>>, ) -> Self
Supply a default without changing an application override.
Sourcepub fn attribute(&self, name: &str) -> Option<&AttributeValue<'a>>
pub fn attribute(&self, name: &str) -> Option<&AttributeValue<'a>>
Inspect a supplied override or default before validation.