struct TraitMethod {Show 19 fields
ident: Ident,
sig: Signature,
has_self: bool,
is_mut: bool,
worker: bool,
unsafe_main_thread: bool,
coerce: bool,
check_interrupt: bool,
rng: bool,
unwrap_in_r: bool,
param_defaults: HashMap<String, String>,
param_tags: Vec<String>,
skip: bool,
r_name: Option<String>,
strict: bool,
lifecycle: Option<LifecycleSpec>,
r_entry: Option<String>,
r_post_checks: Option<String>,
r_on_exit: Option<ROnExit>,
}Expand description
Parsed method from a trait impl block.
Stores everything needed to generate C wrappers, R wrappers, and vtable
shims for a single method in an impl Trait for Type block.
Fields§
§ident: IdentRust method identifier (e.g., value, increment).
sig: SignatureFull method signature including self receiver and all parameters.
has_self: boolWhether the method has a receiver (&self, &mut self).
False for static/associated methods.
is_mut: boolWhether receiver is &mut self (vs &self). Only meaningful if has_self is true.
worker: boolWhen true, dispatches to the worker thread via run_on_worker.
Set by explicit #[miniextendr(worker)] or the default-worker feature flag.
unsafe_main_thread: boolWhen true, forces execution on R’s main thread via unsafe(main_thread).
coerce: boolEnable automatic type coercion for all parameters via Rf_coerceVector.
check_interrupt: boolCheck for R user interrupts (R_CheckUserInterrupt) before calling the method.
rng: boolEnable RNG state management (GetRNGstate/PutRNGstate) around the call.
unwrap_in_r: boolReturn Result<T, E> to R without unwrapping – R wrapper receives the result variant.
param_defaults: HashMap<String, String>Parameter default values from #[miniextendr(defaults(param = "value", ...))].
Keys are parameter names, values are R expressions used as default values.
Roxygen @param tags extracted from method doc comments.
skip: boolWhen true, this method is excluded from C wrappers, R wrappers, and vtable shims. The method is still kept in the emitted impl block (it’s a real trait method).
r_name: Option<String>Override the R-facing method name. When set, the R wrapper uses this name
instead of the Rust method name (e.g., next -> next_item to avoid R reserved words).
strict: boolStrict output conversion: panic instead of lossy widening for i64/u64/isize/usize.
lifecycle: Option<LifecycleSpec>Lifecycle specification for deprecation/experimental status.
r_entry: Option<String>R code to inject at the very top of the wrapper body.
r_post_checks: Option<String>R code to inject after all checks, immediately before .Call().
r_on_exit: Option<ROnExit>Register on.exit() cleanup code in the R wrapper.
Implementations§
Source§impl TraitMethod
impl TraitMethod
Sourcefn r_method_name(&self) -> String
fn r_method_name(&self) -> String
Returns the R-facing method name.
Uses r_name override if set, otherwise falls back to the Rust identifier string.
Sourcefn c_wrapper_ident(&self, type_ident: &Ident, trait_name: &Ident) -> Ident
fn c_wrapper_ident(&self, type_ident: &Ident, trait_name: &Ident) -> Ident
Generates the C wrapper function identifier: C_{Type}__{Trait}__{method}.
This is the symbol name registered with R via R_CallMethodDef for .Call() access.
Sourcefn c_wrapper_ident_string(
&self,
type_ident: &Ident,
trait_name: &Ident,
) -> String
fn c_wrapper_ident_string( &self, type_ident: &Ident, trait_name: &Ident, ) -> String
Generates the C wrapper identifier as a String, for use in R-side .Call() generation.
Prefer c_wrapper_ident() for Rust token generation; use this variant
when building R code strings (e.g., ".Call(C_Type__Trait__method, ...)").
Sourcefn returns_unit(&self) -> bool
fn returns_unit(&self) -> bool
Returns true if this method has no return type (returns unit ()).
Used to decide whether the R wrapper should emit invisible(x) for
void instance methods (pipe-friendly chaining).
Sourcefn call_method_def_ident(&self, type_ident: &Ident, trait_name: &Ident) -> Ident
fn call_method_def_ident(&self, type_ident: &Ident, trait_name: &Ident) -> Ident
Generates the R_CallMethodDef static identifier: call_method_def_{Type}__{Trait}_{method}.
This constant holds the C function pointer and arity used by R’s .Call() registration.
Trait Implementations§
Source§impl Clone for TraitMethod
impl Clone for TraitMethod
Source§fn clone(&self) -> TraitMethod
fn clone(&self) -> TraitMethod
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TraitMethod
impl RefUnwindSafe for TraitMethod
impl !Send for TraitMethod
impl !Sync for TraitMethod
impl Unpin for TraitMethod
impl UnsafeUnpin for TraitMethod
impl UnwindSafe for TraitMethod
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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: 736 bytes