Expand description
Parser and expansion for the typed_dataframe! macro.
Generates a struct that wraps an R data.frame, validates declared
columns via TryFromSexp, and exposes borrowed per-column accessors.
ยงSyntax
โ
typed_dataframe! {
/// The shape we accept for the Theoph PK dataset.
pub TheophDf {
subject: i32,
weight: f64,
dose: f64,
flag: Option<i32>, // optional column
}
}Expands to a struct TheophDf with TryFromSexp and per-column
accessors (subject() -> &[i32], flag() -> Option<&[i32]>).
Re-exportsยง
use proc_macro2::TokenStream;๐use quote::format_ident;๐use quote::quote;๐use syn::parse::Parse;๐use syn::parse::ParseStream;๐use syn::punctuated::Punctuated;๐use syn::Attribute;๐use syn::Ident;๐use syn::Ident;๐use syn::Token;๐use syn::Type;๐use syn::TypePath;๐use syn::Visibility;๐
Structsยง
- Typed
Dataframe Field - A single column declaration.
- Typed
Dataframe Input - Parsed input for
typed_dataframe!.
Functionsยง
- expand_
typed_ dataframe - Expand a parsed
typed_dataframe!into the generated struct, impls, and per-column accessors. - unwrap_
option ๐ - If
tyisOption<T>, returnT; otherwiseNone.