#[non_exhaustive]pub struct OptionsBuilder { /* 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 OptionsBuilder
impl OptionsBuilder
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_strict(self) -> Self
pub fn with_strict(self) -> Self
Enable strict mode.
When enabled, issues that would normally result in a warning and fallback behavior will instead cause parsing to fail.
§Example
use acdc_parser::Options;
let options = Options::builder()
.with_strict()
.build();Sourcepub fn with_attribute(
self,
name: impl Into<String>,
value: impl Into<AttributeValue>,
) -> Self
pub fn with_attribute( self, name: impl Into<String>, value: impl Into<AttributeValue>, ) -> Self
Add a document attribute with a string value.
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(self, document_attributes: DocumentAttributes) -> Self
pub fn with_attributes(self, document_attributes: DocumentAttributes) -> Self
Set all document attributes at once.
§Example
use acdc_parser::{Options, DocumentAttributes, AttributeValue};
let mut attrs = DocumentAttributes::default();
attrs.insert("toc".into(), AttributeValue::String("left".into()));
let options = Options::builder()
.with_attributes(attrs)
.build();Trait Implementations§
Source§impl Clone for OptionsBuilder
impl Clone for OptionsBuilder
Source§fn clone(&self) -> OptionsBuilder
fn clone(&self) -> OptionsBuilder
Returns a duplicate 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 OptionsBuilder
impl Debug for OptionsBuilder
Source§impl Default for OptionsBuilder
impl Default for OptionsBuilder
Source§fn default() -> OptionsBuilder
fn default() -> OptionsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OptionsBuilder
impl RefUnwindSafe for OptionsBuilder
impl Send for OptionsBuilder
impl Sync for OptionsBuilder
impl Unpin for OptionsBuilder
impl UnwindSafe for OptionsBuilder
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