pub struct ParsedImpl {Show 21 fields
pub type_ident: Ident,
pub class_system: ClassSystem,
pub class_name: Option<String>,
pub label: Option<String>,
pub doc_tags: Vec<String>,
pub methods: Vec<ParsedMethod>,
pub original_impl: ItemImpl,
pub cfg_attrs: Vec<Attribute>,
pub vctrs_attrs: VctrsAttrs,
pub r6_inherit: Option<String>,
pub r6_portable: Option<bool>,
pub r6_cloneable: Option<bool>,
pub r6_lock_objects: Option<bool>,
pub r6_lock_class: Option<bool>,
pub s7_parent: Option<String>,
pub s7_abstract: bool,
pub r_data_accessors: bool,
pub strict: bool,
pub internal: bool,
pub noexport: bool,
pub param_warnings: TokenStream,
}Expand description
Fully parsed #[miniextendr] impl block, ready for code generation.
Contains the type identity, chosen class system, all parsed methods, the original
impl block (with miniextendr attrs stripped for re-emission), and all class-system-specific
configuration options. Created by ParsedImpl::parse and consumed by the per-class-system
R wrapper generators and generate_method_c_wrapper.
Fields§
§type_ident: IdentThe Rust type name being implemented (e.g., Counter).
class_system: ClassSystemWhich R class system to generate wrappers for.
class_name: Option<String>Optional override for the R class name. When None, uses type_ident as the class name.
label: Option<String>Optional label for distinguishing multiple impl blocks of the same type.
Roxygen tag lines extracted from /// doc comments on the impl block.
Used for class-level documentation (e.g., the R6 class docstring or S3 type description).
methods: Vec<ParsedMethod>All parsed methods in this impl block, in source order.
original_impl: ItemImplThe original impl block with #[miniextendr] and roxygen attrs stripped.
Re-emitted as-is so the Rust compiler sees the actual method implementations.
cfg_attrs: Vec<Attribute>#[cfg(...)] attributes from the impl block, propagated to all generated items
(C wrappers, R wrapper constants, call def arrays) for conditional compilation.
vctrs_attrs: VctrsAttrsvctrs-specific attributes (only used when class_system is Vctrs)
r6_inherit: Option<String>R6 parent class name for inheritance (e.g., "ParentClass").
Propagated from ImplAttrs::r6_inherit.
r6_portable: Option<bool>R6 portable flag. When Some(true), generates a portable R6 class.
Propagated from ImplAttrs::r6_portable.
r6_cloneable: Option<bool>R6 cloneable flag. Controls whether $clone() is available on instances.
Propagated from ImplAttrs::r6_cloneable.
r6_lock_objects: Option<bool>R6 lock_objects flag. When Some(true), prevents adding new fields after creation.
Propagated from ImplAttrs::r6_lock_objects.
r6_lock_class: Option<bool>R6 lock_class flag. When Some(true), prevents modifying the class definition.
Propagated from ImplAttrs::r6_lock_class.
s7_parent: Option<String>S7 parent class name for inheritance (e.g., "ParentClass").
Propagated from ImplAttrs::s7_parent.
s7_abstract: boolWhen true, marks this as an abstract S7 class that cannot be instantiated.
Propagated from ImplAttrs::s7_abstract.
r_data_accessors: boolWhen true, auto-include sidecar #[r_data] field accessors in the class definition.
For R6: active bindings are added via $set("active", ...) after class creation.
For S7: properties are spliced from .rdata_properties_{Type} into new_class().
strict: boolStrict conversion mode: methods returning lossy types use checked conversions.
internal: boolMark class as internal: adds @keywords internal, suppresses @export.
noexport: boolSuppress @export without adding @keywords internal.
param_warnings: TokenStreamDeprecation warnings for @param tags found on the impl block.
Appended to the final TokenStream output.
Implementations§
Source§impl ParsedImpl
impl ParsedImpl
Sourcepub fn parse(attrs: ImplAttrs, item_impl: ItemImpl) -> Result<Self>
pub fn parse(attrs: ImplAttrs, item_impl: ItemImpl) -> Result<Self>
Parse an impl block with class system attribute.
Note: Trait impls (impl Trait for Type) are handled by expand_impl
before this function is called, so we only handle inherent impls here.
Sourcepub fn class_name(&self) -> String
pub fn class_name(&self) -> String
Get the class name (override or type name).
Sourcepub fn included_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn included_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get methods that should be included.
Sourcepub fn constructor(&self) -> Option<&ParsedMethod>
pub fn constructor(&self) -> Option<&ParsedMethod>
Get the constructor method (fn new() -> Self), if included.
Respects #[...(ignore)] and visibility filters.
Sourcefn is_method_constructor(&self, m: &ParsedMethod) -> bool
fn is_method_constructor(&self, m: &ParsedMethod) -> bool
Class-system-aware constructor detection.
The default ParsedMethod::is_constructor requires the method to return
Self. For vctrs impls that’s too strict: the canonical vctrs
constructor pattern returns the underlying vector payload (e.g.
Vec<f64>) which vctrs::new_vctr() then wraps — returning Self
would produce an ExternalPtr that new_vctr can’t accept as .data.
Sourcepub fn public_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn public_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get public instance methods (have env, not private, not active).
Sourcepub fn private_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn private_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get private instance methods (have env, private visibility, not active).
Sourcepub fn active_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn active_instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get active binding getter methods for R6 (have env, marked active, not setter). Active bindings provide property-like access (obj$name instead of obj$name()).
Sourcepub fn active_setter_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn active_setter_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get active binding setter methods for R6 (have env, marked as r6_setter).
Sourcepub fn find_setter_for_prop(&self, prop_name: &str) -> Option<&ParsedMethod>
pub fn find_setter_for_prop(&self, prop_name: &str) -> Option<&ParsedMethod>
Find the setter method for a given property name.
Sourcepub fn instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn instance_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get instance methods (have env) - includes both public and private.
Sourcepub fn static_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn static_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get static methods (no env, not constructor, not finalizer).
Sourcepub fn as_coercion_methods(&self) -> impl Iterator<Item = &ParsedMethod>
pub fn as_coercion_methods(&self) -> impl Iterator<Item = &ParsedMethod>
Get methods with #[miniextendr(as = "...")] attribute.
These generate S3 methods for R’s as.<class>() generics like
as.data.frame.MyType, as.list.MyType, etc.
Sourcepub fn finalizer(&self) -> Option<&ParsedMethod>
pub fn finalizer(&self) -> Option<&ParsedMethod>
Get the finalizer method, if any.
Sourcepub fn r_wrappers_const_ident(&self) -> Ident
pub fn r_wrappers_const_ident(&self) -> Ident
Module constant identifier for R wrapper parts.
Format: R_WRAPPERS_IMPL_{TYPE} or R_WRAPPERS_IMPL_{TYPE}_{LABEL} if labeled.
Trait Implementations§
Source§impl Debug for ParsedImpl
impl Debug for ParsedImpl
Source§impl ParsedImplExt for ParsedImpl
impl ParsedImplExt for ParsedImpl
Source§fn constructor_context(&self) -> Option<MethodContext<'_>>
fn constructor_context(&self) -> Option<MethodContext<'_>>
MethodContext for the constructor method, if one exists.Source§fn instance_method_contexts(&self) -> impl Iterator<Item = MethodContext<'_>>
fn instance_method_contexts(&self) -> impl Iterator<Item = MethodContext<'_>>
MethodContext.Source§fn static_method_contexts(&self) -> impl Iterator<Item = MethodContext<'_>>
fn static_method_contexts(&self) -> impl Iterator<Item = MethodContext<'_>>
MethodContext.Source§fn public_instance_method_contexts(
&self,
) -> impl Iterator<Item = MethodContext<'_>>
fn public_instance_method_contexts( &self, ) -> impl Iterator<Item = MethodContext<'_>>
MethodContext (for R6 public list).Source§fn private_instance_method_contexts(
&self,
) -> impl Iterator<Item = MethodContext<'_>>
fn private_instance_method_contexts( &self, ) -> impl Iterator<Item = MethodContext<'_>>
MethodContext (for R6 private list).Source§fn active_instance_method_contexts(
&self,
) -> impl Iterator<Item = MethodContext<'_>>
fn active_instance_method_contexts( &self, ) -> impl Iterator<Item = MethodContext<'_>>
MethodContext (for R6 active list).Auto Trait Implementations§
impl Freeze for ParsedImpl
impl RefUnwindSafe for ParsedImpl
impl !Send for ParsedImpl
impl !Sync for ParsedImpl
impl Unpin for ParsedImpl
impl UnsafeUnpin for ParsedImpl
impl UnwindSafe for ParsedImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 616 bytes