pub struct Doc { /* private fields */ }Expand description
A document: its content together with the option values set on it.
A Doc does not change once built, and several runs may share one, for
example to render the same document in two formats, or to check it and then
render it. What a run computes (tables of data, the diagnostics of its
stages) is kept by that run, not here. A run is constructed over a document
with Run::new.
Implementations§
Source§impl Doc
impl Doc
Sourcepub fn new(content: DocContent) -> Doc
pub fn new(content: DocContent) -> Doc
A document holding content, with no option value set on it. A stage
then reads, for each option type, the value set on the render request,
or else the type’s default.
Sourcepub fn with_options(content: DocContent, options: OptionValues) -> Doc
pub fn with_options(content: DocContent, options: OptionValues) -> Doc
A document holding content, with the option values options set on
it.
The values are not checked here. Constructing a run over this document
(Run::new) checks them against the
option types the registry declares, and fails with
RunError::DocumentOption
when a value is set for an option type that no feature declares or that
cannot be set on a document. See crate::model::options.
Sourcepub fn content(&self) -> &DocContent
pub fn content(&self) -> &DocContent
The document’s content: its trees, their order, and which node places which tree.
Sourcepub fn options(&self) -> &OptionValues
pub fn options(&self) -> &OptionValues
The option values set on this document.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Doc
impl !UnwindSafe for Doc
impl Forget for Doc
impl Freeze for Doc
impl Move for Doc
impl Send for Doc
impl Sync for Doc
impl Unpin for Doc
impl UnsafeUnpin for Doc
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more