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.
- 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. - find_
tag_ πvalue - Find the value of a specific roxygen tag (e.g., βtitleβ for
@title ...). - 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_
details_ πfrom_ attrs - Extract the implicit details from doc attributes (paragraphs 3+).
- 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.
- 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 with optional auto-description for impl methods.
- roxygen_
tags_ πfrom_ attrs_ impl - Core implementation of roxygen tag extraction from
#[doc = "..."]attributes. - strip_
method_ πtags - Filter out method-specific roxygen tags from impl-block-level docs and emit compile warnings for each stripped tag.
- 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.