Skip to main content

Module roxygen

Module roxygen 

Source
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 @source traceability line for a class definition.
doc_conflict_warnings πŸ”’
Check for conflicts between explicit @title/@description tags 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 @source traceability 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_tags but takes &[&str] for filtered tag slices.
roxygen_tag_name πŸ”’
Extract the tag name from a roxygen line (everything between @ and the first whitespace character). Returns None for 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.