pub enum ReturnStrategy {
ReturnSelf,
ChainableMutation,
Direct,
}Expand description
Return handling strategy for class methods.
Determines how the R wrapper function processes and returns the .Call() result.
Each class system generator uses this to produce idiomatic R return code.
Variants§
ReturnSelf
The method returns Self. The wrapper wraps the raw pointer result with
the appropriate class attribute or creates a new class object (e.g.,
R6Class$new(.ptr = result) or structure(result, class = "...")).
ChainableMutation
The method is a &mut self method returning (). The wrapper calls the
.Call() for its side effect and returns the receiver (self/x) for
method chaining (e.g., invisible(self) for R6).
Direct
Default strategy: return the .Call() result directly without wrapping.
Implementations§
Source§impl ReturnStrategy
impl ReturnStrategy
Sourcepub fn for_method(method: &ParsedMethod) -> Self
pub fn for_method(method: &ParsedMethod) -> Self
Determine the return strategy for a parsed method.
- Methods that return
Self,Result<Self, E>, orOption<Self>useReturnSelf. For the latter two, the C wrapper already raised onErr/None(seecrate::c_wrapper_builder::ReturnHandling::ResultExternalPtrandcrate::c_wrapper_builder::ReturnHandling::OptionExternalPtr), so a successful.valis a bare ExternalPtr — identical in shape to the bare-Selfcase — and gets the same class-wrapping tail. - In-place builders (
&mut self -> &mut Self/&self -> Self) and&mut self -> ()methods useChainableMutation. Both return the receiver object (x/invisible(self)) so the call composes under the native pipe (obj |> set_a(1) |> set_b(2)); the C wrapper hands back the same ExternalPtr handle (seecrate::c_wrapper_builder::ReturnHandling::SelfHandle). - All other methods use
Direct
Trait Implementations§
Source§impl Clone for ReturnStrategy
impl Clone for ReturnStrategy
Source§fn clone(&self) -> ReturnStrategy
fn clone(&self) -> ReturnStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReturnStrategy
Source§impl Debug for ReturnStrategy
impl Debug for ReturnStrategy
Source§impl Eq for ReturnStrategy
impl Eq for ReturnStrategy
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
derive_eq_internals)1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
implementation detail of #[derive(Eq)]
Source§impl PartialEq for ReturnStrategy
impl PartialEq for ReturnStrategy
Source§fn eq(&self, other: &ReturnStrategy) -> bool
fn eq(&self, other: &ReturnStrategy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ReturnStrategy
impl TrivialClone for ReturnStrategy
Auto Trait Implementations§
impl Freeze for ReturnStrategy
impl RefUnwindSafe for ReturnStrategy
impl Send for ReturnStrategy
impl Sync for ReturnStrategy
impl Unpin for ReturnStrategy
impl UnsafeUnpin for ReturnStrategy
impl UnwindSafe for ReturnStrategy
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,
impl<T> Printable for 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: 1 byte
Size for each variant:
ReturnSelf: 0 bytesChainableMutation: 0 bytesDirect: 0 bytes