pub struct DotCallBuilder {
c_ident: String,
self_var: Option<String>,
args: Vec<String>,
call_expr: Option<String>,
}Expand description
Builder for formatting .Call() invocations in R wrapper code.
Handles the common pattern of .Call(C_ident, .call = match.call(), args...).
§Example
let call = DotCallBuilder::new("C_Counter__increment")
.with_self("self")
.build();
// => ".Call(C_Counter__increment, .call = match.call(), self)"
let call = DotCallBuilder::new("C_Counter__add")
.with_self("x")
.with_args(&["n"])
.build();
// => ".Call(C_Counter__add, .call = match.call(), x, n)"Fields§
§c_ident: StringThe C entry point symbol name (e.g., "C_Counter__increment").
This is the first argument to .Call().
self_var: Option<String>Optional self/receiver variable name (e.g., "self", "x").
When present, prepended before other arguments in the .Call() invocation.
args: Vec<String>Additional argument names passed after self (if any) in the .Call() invocation.
call_expr: Option<String>Expression for the .call named argument. None means match.call() (the default).
Set via DotCallBuilder::null_call_attribution to emit .call = NULL instead.
Implementations§
Source§impl DotCallBuilder
impl DotCallBuilder
Sourcepub fn new(c_ident: impl Into<String>) -> Self
pub fn new(c_ident: impl Into<String>) -> Self
Create a new builder with the C function identifier.
Sourcepub fn with_self(self, var: impl Into<String>) -> Self
pub fn with_self(self, var: impl Into<String>) -> Self
Add a self/x parameter (prepended to args).
Sourcepub fn with_args_str(self, args: &str) -> Self
pub fn with_args_str(self, args: &str) -> Self
Add a pre-joined argument string (e.g., "x, y") as a single emit unit.
Empty strings are ignored, so callers can pass the result of
build_r_call_args_from_sig directly without a length check.
Sourcepub fn null_call_attribution(self) -> Self
pub fn null_call_attribution(self) -> Self
Pass .call = NULL instead of .call = match.call().
Use for lambda dispatch sites (R6 finalizer/deep_clone, S7 property
getter/setter/validator) where match.call() captures an internal
dispatch frame instead of the user’s call. With NULL, the
if (is.null(.val$call)) .call_default else .val$call fallback in condition_check_lines surfaces the
nearest meaningful frame instead.
Auto Trait Implementations§
impl Freeze for DotCallBuilder
impl RefUnwindSafe for DotCallBuilder
impl Send for DotCallBuilder
impl Sync for DotCallBuilder
impl Unpin for DotCallBuilder
impl UnsafeUnpin for DotCallBuilder
impl UnwindSafe for DotCallBuilder
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: 96 bytes