pub struct MarkupDoc {
pub title: Option<String>,
pub blocks: Vec<MarkupBlock>,
pub attrs: BTreeMap<String, Expr>,
pub source: Option<SourceDoc>,
}Expand description
A semantic markup document independent of its concrete source backend.
Fields§
§title: Option<String>Optional document title.
blocks: Vec<MarkupBlock>Semantic block sequence.
attrs: BTreeMap<String, Expr>Open document attributes carried as ordinary SIM expressions.
source: Option<SourceDoc>Original source text, when a backend can preserve it.
Implementations§
Source§impl MarkupDoc
impl MarkupDoc
Sourcepub fn from_expr(expr: &Expr) -> Result<Self>
pub fn from_expr(expr: &Expr) -> Result<Self>
Reconstruct a markup document from ordinary SIM data.
Sourcepub fn to_source_text(&self) -> String
pub fn to_source_text(&self) -> String
Render this document to a deterministic source string.
When verbatim source is present, it wins. Documents constructed directly from semantic blocks use a small Markdown-like writer.
Trait Implementations§
impl StructuralPartialEq for MarkupDoc
Auto Trait Implementations§
impl Freeze for MarkupDoc
impl RefUnwindSafe for MarkupDoc
impl Send for MarkupDoc
impl Sync for MarkupDoc
impl Unpin for MarkupDoc
impl UnsafeUnpin for MarkupDoc
impl UnwindSafe for MarkupDoc
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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