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 = sys.call(), args...).
§Example
let call = DotCallBuilder::new("C_Counter__increment")
.with_self("self")
.build();
// => ".Call(C_Counter__increment, .call = sys.call(), self)"
let call = DotCallBuilder::new("C_Counter__add")
.with_self("x")
.with_args(&["n"])
.build();
// => ".Call(C_Counter__add, .call = sys.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 sys.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 = sys.call(): for the R6 / S7
lambda frames, which R6 / S7 dispatch calls (R6 finalizer / deep_clone, S7
property getter / setter / validator), where sys.call() names an
internal dispatch frame instead of the user’s call. Not reachable from
any attribute. With NULL, the raise helper’s fallback (a NULL
.val$call takes .call_default, the sys.call() in
condition_check_lines; only a call-less condition’s FALSE marker
gives NULL) surfaces the nearest meaningful frame instead.
Sourcepub fn with_call_attribution(self, attribution: CallAttribution) -> Self
pub fn with_call_attribution(self, attribution: CallAttribution) -> Self
Pass the .call of attribution (CallAttribution::dot_call_expr):
environment() for a generated S3 method
(CallAttribution::Generic, #1851), which the raise helper turns into
the generic’s call when a condition is raised.
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> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§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