Skip to main content

Module reexport

Module reexport 

Source
Expand description

reexport!(pkg::name, ...): R re-exports declared from Rust (#1910).

Each item is another package’s export that this package exports too. The macro registers one ReexportEntry per item in miniextendr_api::registry::MX_REEXPORTS; the wrapper writer turns them into roxygen2’s re-export blocks (@importFrom pkg name, @export, pkg::name), one per pkg::name however many sites declare it, and refuses a name re-exported from two packages or bound by the package itself.

The package and a syntactic name are dot-joined identifiers (data.table::fread, stats::na.omit); a non-syntactic name is a string literal (magrittr::"%>%"). Every problem of one invocation is reported at once, each on its own tokens.

Re-exportsΒ§

use proc_macro2::Span; πŸ”’
use proc_macro2::TokenStream; πŸ”’
use proc_macro2::TokenTree; πŸ”’
use quote::ToTokens; πŸ”’
use quote::quote; πŸ”’
use syn::ext::IdentExt; πŸ”’
use syn::parse::ParseStream; πŸ”’
use syn::parse::Parser; πŸ”’

StructsΒ§

Item πŸ”’
One pkg::name item.

FunctionsΒ§

dotted_identifiers πŸ”’
Identifiers joined by . (data.table, na.omit), read as written: a Rust keyword is an identifier here (base::as.numeric), and a raw identifier loses its r#.
entries πŸ”’
One MX_REEXPORTS entry per item, in an anonymous const _ so any number of invocations live side by side. The slice is host-only, so on wasm32 the invocation expands to nothing.
expand πŸ”’
Expand reexport!(...).
name_problem πŸ”’
Why name can’t be re-exported, if it can’t. Written as identifiers it must be a syntactic R name; a string literal may be any non-empty ASCII text without whitespace, control characters or the quoting characters `, \ and ", which the generated R code and roxygen2 tags write verbatim or between quotes.
package_problem πŸ”’
Why package is not an R package name, if it isn’t.
parse_item πŸ”’
One item: <dotted identifiers>::<dotted identifiers | string literal>.
parse_items πŸ”’
The items of an invocation, or every problem found in it.
split_items πŸ”’
The input split at its top-level commas: each item’s tokens and the comma after it (None after the last). Delimited groups are single token trees, so a comma inside one does not split.