#[non_exhaustive]pub enum RdNode {
Text(String),
RCode(String),
Verb(String),
Comment(String),
Tagged(RdTagged),
Group(RdGroup),
Raw(RawRdNode),
}Expand description
A single node of an Rd document tree.
The design is mostly generic: four leaf kinds carry raw text, one
variant (Tagged) represents every known markup
macro uniformly via RdTag, and Raw is the lossless
fallback for anything that doesn’t fit. See the crate-level
documentation for why semantics (link targets, argument pairing, table
rows) are intentionally left out of this enum.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(String)
A TEXT-tagged leaf: plain documentation text.
RCode(String)
An RCODE-tagged leaf: R source code, as found inside \usage,
\examples, and similar code-valued sections/macros.
Verb(String)
A VERB-tagged leaf: verbatim text, as found inside \verb{...}
and \preformatted{...}.
Comment(String)
A COMMENT-tagged leaf: a %-introduced Rd comment, preserved
(including the leading %) rather than dropped, since
parse_Rd(keep.source = TRUE) keeps them and a lossless AST must
be able to represent whatever the producer handed it.
Tagged(RdTagged)
Any node carrying a known or unknown macro-style Rd_tag.
Group(RdGroup)
An untagged positional-argument group.
Raw(RawRdNode)
A lossless fallback for a node that doesn’t fit the shapes above:
genuinely non-canonical structures such as nodes with unexpected
attributes. Positional-argument groups use RdNode::Group.
Implementations§
Source§impl RdNode
impl RdNode
pub fn tagged( tag: RdTag, option: Option<Vec<RdNode>>, children: Vec<RdNode>, ) -> Self
pub fn group(children: Vec<RdNode>) -> Self
pub fn as_tagged(&self) -> Option<&RdTagged>
pub fn as_group(&self) -> Option<&RdGroup>
pub fn as_raw(&self) -> Option<&RawRdNode>
pub fn into_tagged(self) -> Result<RdTagged, Self>
pub fn into_group(self) -> Result<RdGroup, Self>
pub fn into_raw(self) -> Result<RawRdNode, Self>
Source§impl RdNode
impl RdNode
pub fn conditional(&self, base_path: &RdPath) -> Option<RdConditional<'_>>
pub fn inspect_conditional( &self, base_path: &RdPath, ) -> Result<Option<RdConditional<'_>>, RdShapeError>
Source§impl RdNode
impl RdNode
Sourcepub fn example_control(
&self,
base_path: &RdPath,
) -> Option<RdExampleControl<'_>>
pub fn example_control( &self, base_path: &RdPath, ) -> Option<RdExampleControl<'_>>
Lossily views a canonical example-control wrapper without an option.
Sourcepub fn inspect_example_control(
&self,
base_path: &RdPath,
) -> Result<Option<RdExampleControl<'_>>, RdShapeError>
pub fn inspect_example_control( &self, base_path: &RdPath, ) -> Result<Option<RdExampleControl<'_>>, RdShapeError>
Strictly inspects a canonical example-control wrapper without changing or validating any of its direct children.