Skip to main content

Module prelude

Module prelude 

Source
Expand description

Convenience re-exports for common miniextendr items.

A single use miniextendr_api::prelude::*; brings into scope the most commonly used macros, traits, types, and helpers. Convenience re-exports for common miniextendr items.

A single use miniextendr_api::prelude::*; brings into scope the most commonly used macros, traits, types, and helpers so user crates can avoid a long list of individual imports.

§Optional feature types

When a Cargo feature is enabled (e.g., uuid, regex, ndarray), the prelude includes both the miniextendr adapter types and a re-export of the upstream dependency crate itself. This means you do not need to add optional crates as direct dependencies in your Cargo.toml — enabling the feature on miniextendr-api is enough.

[dependencies]
miniextendr-api = { version = "0.1", features = ["uuid", "ndarray"] }
# No need for: uuid = "1", ndarray = "0.16"

Access the upstream crate via the prelude:

use miniextendr_api::prelude::*;

// Uuid is re-exported from the uuid crate
let id = Uuid::new_v4();

// The full crate is also available for advanced usage
let parsed = uuid::Uuid::parse_str("...").unwrap();

§Example

use miniextendr_api::prelude::*;

#[miniextendr]
fn add(a: i32, b: i32) -> i32 {
    a + b
}

Re-exports§

pub use crate::Altrep;
pub use crate::ExternalPtr;
pub use crate::MatchArg;
pub use crate::RFactor;
pub use crate::list;
pub use crate::typed_list;
pub use crate::Coerce;
pub use crate::IntoR;
pub use crate::IntoRAltrep;
pub use crate::TryCoerce;
pub use crate::TryFromSexp;
pub use crate::IntoList;
pub use crate::Lazy;
pub use crate::List;
pub use crate::ListBuilder;
pub use crate::ListMut;
pub use crate::Missing;
pub use crate::NamedVector;
pub use crate::OwnedProtect;
pub use crate::ProtectScope;
pub use crate::Protected;
pub use crate::ProtectedStrVec;
pub use crate::RCow;
pub use crate::StrVec;
pub use crate::StrVecBuilder;
pub use crate::DataFrame;
pub use crate::DataFrameError;
pub use crate::FromDataFrame;
pub use crate::IntoDataFrame;
pub use crate::Sendable;
pub use crate::with_r_thread;
pub use crate::r_print;
pub use crate::r_println;
pub use crate::r_warning;
pub use crate::expression::r_eval_str;
pub use crate::r_str;
pub use crate::SEXP;
pub use crate::SexpExt;

Macros§

list
Construct an R list from Rust values.
r
Evaluate R code written as Rust tokens, validated at compile time.
typed_dataframe
Define a compile-time-validated wrapper for an R data.frame input.
typed_list
Create a TypedListSpec for validating ... arguments or lists.

Attribute Macros§

miniextendr
Export Rust items to R.

Derive Macros§

Altrep
Derive ALTREP registration for a data struct.
DataFrameRow
Derive DataFrameRow: generates a companion *DataFrame type with collection fields, plus IntoR / TryFromSexp / IntoDataFrame impls for seamless R data.frame conversion.
ExternalPtr
Derive macro for implementing TypedExternal on a type.
IntoList
Derive IntoList for a struct (Rust → R list).
IntoR
Derive IntoR for a single-field newtype: forward the Rust → R conversion to the inner type.
MatchArg
Derive MatchArg: enables conversion between Rust enums and R character strings with match.arg semantics (partial matching, informative errors).
RFactor
Derive RFactor: enables conversion between Rust enums and R factors.
TryFromSexp
Derive TryFromSexp for a single-field newtype: forward the R → Rust conversion to the inner type.