pub enum Node {
Text(Option<Styles>, Cow<'static, str>),
Anchor {
is_def: bool,
anchor: Rc<str>,
text: Box<[(Option<Styles>, Cow<'static, str>)]>,
},
IndentedBlock(Vec<Fragment>),
InlineOrIndentedBlock(Vec<Fragment>),
BreakingOnlySpace,
ForceLineSeparation,
IfBlockLayout(&'static str),
}
Variants§
Text(Option<Styles>, Cow<'static, str>)
Anchor
Anchor (HTML <a href="#...">
, optionally with id="..."
when is_def
),
using Node::Text
-like “styled text” nodes for its text contents.
IndentedBlock(Vec<Fragment>)
Container for Fragment
s, using block layout (indented on separate lines).
InlineOrIndentedBlock(Vec<Fragment>)
Container for Fragment
s, either using inline layout (all on one line)
or block layout (indented on separate lines).
BreakingOnlySpace
Require that nodes before and after this node, are separated by some whitespace (either by a single space, or by being on different lines).
This is similar in effect to a Text(" ")
, except that it doesn’t add
leading/trailing spaces when found at the start/end of a line, as the
adjacent \n
is enough of a “breaking space”.
Conversely, Text(" ")
can be considered a “non-breaking space” (NBSP).
ForceLineSeparation
Require that nodes before and after this node, go on different lines.
This is similar in effect to a Text("\n")
, except that it doesn’t
introduce a new \n
when the previous/next node(s) already end/start
on a new line (whether from Text("\n")
or another ForceLineStart
).
IfBlockLayout(&'static str)
Implementations§
source§impl Node
impl Node
sourcefn approx_rigid_layout(&self) -> ApproxLayout
fn approx_rigid_layout(&self) -> ApproxLayout
Determine the “rigid” component of the ApproxLayout
of this Node
.
That is, this accounts for the parts of the Node
that don’t depend on
contextual sizing, i.e. MaxWidths
(see also approx_flex_layout
).
sourcefn approx_flex_layout(&mut self, max_widths: MaxWidths) -> ApproxLayout
fn approx_flex_layout(&mut self, max_widths: MaxWidths) -> ApproxLayout
Determine the “flexible” component of the ApproxLayout
of this Node
,
potentially making adjustments in order to fit within max_widths
.
That is, this accounts for the parts of the Node
that do depend on
contextual sizing, i.e. MaxWidths
(see also approx_rigid_layout
).