#[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_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<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
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<'a>,
) -> Self
pub fn with_attributes( self, document_attributes: DocumentAttributes<'a>, ) -> 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<'a> Clone for OptionsBuilder<'a>
impl<'a> Clone for OptionsBuilder<'a>
Source§fn clone(&self) -> OptionsBuilder<'a>
fn clone(&self) -> OptionsBuilder<'a>
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<'a> Debug for OptionsBuilder<'a>
impl<'a> Debug for OptionsBuilder<'a>
Source§impl<'a> Default for OptionsBuilder<'a>
impl<'a> Default for OptionsBuilder<'a>
Source§fn default() -> OptionsBuilder<'a>
fn default() -> OptionsBuilder<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for OptionsBuilder<'a>
impl<'a> RefUnwindSafe for OptionsBuilder<'a>
impl<'a> Send for OptionsBuilder<'a>
impl<'a> Sync for OptionsBuilder<'a>
impl<'a> Unpin for OptionsBuilder<'a>
impl<'a> UnsafeUnpin for OptionsBuilder<'a>
impl<'a> UnwindSafe for OptionsBuilder<'a>
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