Expand description
Roxygen tag extraction and processing for R wrapper generation.
This module extracts roxygen2-style tags (e.g., @param, @examples) from Rust
doc comments and propagates them to generated R wrapper code.
Β§Usage
In Rust doc comments, use roxygen2 tags:
β
/// @param x A numeric input.
/// @return The squared value.
/// @examples
/// square(4)
#[miniextendr]
pub fn square(x: f64) -> f64 { x * x }Β§R Package Configuration
For roxygen2 to process multiline tags correctly, add this to your DESCRIPTION file:
Roxygen: list(markdown = TRUE)ConstantsΒ§
- METHOD_
ONLY_ πTAGS - Roxygen tags that only make sense on individual methods, not on impl blocks.
- METHOD_
ONLY_ πTAGS_ R6 - Tags stripped from impl-block docs for R6 classes β same as
METHOD_ONLY_TAGSminus"param", since roxygen2 8.0.0 inherits class-level@paramtags into all R6 methods and strips them from the rendered method entries automatically. This means/// @param breed β¦on an R6 impl block is valid and intentional, not a misplaced method-only tag. Keeping them avoids both the compile warning and the resulting(no documentation available)placeholder on subclass ctors. - MULTILINE_
TAGS π - Tags that allow multi-line content (continuation lines appended). All other tags are treated as single-line.
FunctionsΒ§
- class_
source_ πtag - Build a roxygen
@sourcetraceability line for a class definition. - doc_
conflict_ πwarnings - Check for conflicts between explicit
@title/@descriptiontags and implicit values. - explicit_
roxygen_ πtags_ from_ attrs - Parse only the author-written
@taglines from doc attributes β no leading-prose promotion. - extract_
param_ πnames - Extract the set of parameter names declared via
@paramin a list of roxygen tags. - find_
tag_ πvalue - Find the value of a specific roxygen tag (e.g., βtitleβ for
@title ...). - formal_
name π - Extract the R parameter name from a single formal (e.g.
mode = c("a","b")βmode). Pair withsplit_r_formals, never a rawsplit(','). - format_
roxygen_ πtags - Render roxygen tag lines as β#β β¦β comment lines.
- has_
roxygen_ πtag - Return true if the tag list contains a specific roxygen tag.
- implicit_
description_ πfrom_ attrs - Extract the implicit description from doc attributes (second paragraph).
- implicit_
title_ πfrom_ attrs - Extract the implicit title from doc attributes (first sentence, up to first
.or newline). - is_
multiline_ πtag - Check if a tag name supports multi-line content.
- leading_
prose_ πfrom_ attrs - Collect the leading prose of a doc comment (all paragraphs before the first
@tag) as roxygen@descriptiontext, with rustdoc intra-doc links neutralized. - method_
source_ πtag - Build a roxygen
@sourcetraceability line for a class method. - normalize_
for_ πcomparison - Normalize text for comparison: lowercase, collapse whitespace, strip trailing punctuation.
- push_
roxygen_ πtags - Push roxygen tag lines into a vector of R wrapper lines.
- push_
roxygen_ πtags_ str - Like
push_roxygen_tagsbut takes&[&str]for filtered tag slices. - roxygen_
tag_ πname - Extract the tag name from a roxygen line (everything between
@and the first whitespace character). ReturnsNonefor lines that donβt start with a tag. - roxygen_
tags_ πfrom_ attrs - Extract roxygen tag lines (starting with β@β) from Rust doc attributes.
- roxygen_
tags_ πfrom_ attrs_ for_ r6_ method - Extract roxygen tags for an impl-block method.
- roxygen_
tags_ πfrom_ attrs_ impl - Core implementation of roxygen tag extraction from
#[doc = "..."]attributes. - sanitize_
roxygen_ πlinks - Neutralize rustdoc intra-doc link syntax so prose is valid roxygen2 markdown.
- split_
r_ πformals - Split an R formals/argument string on top-level commas only.
- strip_
method_ πtags - Filter out method-specific roxygen tags from impl-block-level docs and emit compile warnings for each stripped tag.
- strip_
method_ πtags_ r6 - Like
strip_method_tagsbut for R6 impl blocks. - strip_
roxygen_ πfrom_ attrs - Strip roxygen tag lines from doc attributes, keeping only regular documentation.
- tag_
names π - Extract the set of tag names from a list of roxygen tag strings.