Skip to main content

Module adapter_traits

Module adapter_traits 

Source
Expand description

Built-in adapter traits for std library traits.

Provides RDebug, RDisplay, RHash, ROrd, RPartialOrd, RError, RFromStr, RClone, RCopy, RDefault, RIterator, RExtend, RFromIter, RToVec, and RMakeIter with blanket implementations where possible. Methods that share a name with a std method are r_-prefixed in Rust and keep the std name in R, so importing these traits leaves std calls alone. See module docs for usage.

Built-in adapter traits for common Rust standard library traits.

These traits provide blanket implementations that allow any Rust type implementing standard traits to be exposed to R without boilerplate.

§Example

ⓘ
use miniextendr_api::prelude::*;

#[derive(Debug, ExternalPtr)]
struct MyData {
    values: Vec<i32>,
}

// RDebug is automatically available for any Debug type
#[miniextendr]
impl miniextendr_api::adapter_traits::RDebug for MyData {}

In R:

data <- MyData$new(...)
data$RDebug$debug_str()        # "MyData { values: [1, 2, 3] }"
data$RDebug$debug_str_pretty() # Pretty-printed with newlines

§Rust method names

A method whose name a std trait or a covered type already uses gets an r_ prefix in Rust and keeps the std name in R through #[miniextendr(r_name = "...")]: RClone::r_clone is clone() in R. The blanket impls cover every Clone, Default, Hash, Ord, PartialOrd and FromStr type, and RToVec every array and boxed slice, so with the std names an import of these traits would make the importing module’s own v.clone() or a.cmp(&b) ambiguous (E0034), and its [T; N]::len() an i64.

Both empty and populated #[miniextendr] impl blocks inherit the trait’s R names and skipped methods. This includes generic RToVec<T> and RExtend<T> and the associated-type RIterator. An explicit impl-level r_name overrides the declaration’s name for that implementation.

Re-exports§

pub use __mx_trait_metadata_RDebug_0 as RDebug; 👻
pub use __mx_trait_metadata_RDisplay_1 as RDisplay; 👻
pub use __mx_trait_metadata_RHash_2 as RHash; 👻
pub use __mx_trait_metadata_ROrd_3 as ROrd; 👻
pub use __mx_trait_metadata_RPartialOrd_4 as RPartialOrd; 👻
pub use __mx_trait_metadata_RError_5 as RError; 👻
pub use __mx_trait_metadata_RFromStr_6 as RFromStr; 👻
pub use __mx_trait_metadata_RClone_7 as RClone; 👻
pub use __mx_trait_metadata_RDefault_8 as RDefault; 👻
pub use __mx_trait_metadata_RCopy_9 as RCopy; 👻
pub use __mx_trait_metadata_RIterator_10 as RIterator; 👻
pub use __mx_trait_metadata_RExtend_11 as RExtend; 👻
pub use __mx_trait_metadata_RFromIter_12 as RFromIter; 👻
pub use __mx_trait_metadata_RToVec_13 as RToVec; 👻
pub use __mx_trait_metadata_RMakeIter_14 as RMakeIter; 👻

Structs§

RCloneVTable 👻
Vtable for the RClone trait. Generated from source location line 404, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RCloneView
Runtime view for objects implementing RClone. Generated from source location line 404, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RCopyVTable 👻
Vtable for the RCopy trait. Generated from source location line 493, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RCopyView
Runtime view for objects implementing RCopy. Generated from source location line 493, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDebugVTable 👻
Vtable for the RDebug trait. Generated from source location line 71, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDebugView
Runtime view for objects implementing RDebug. Generated from source location line 71, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDefaultVTable 👻
Vtable for the RDefault trait. Generated from source location line 445, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDefaultView
Runtime view for objects implementing RDefault. Generated from source location line 445, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDisplayVTable 👻
Vtable for the RDisplay trait. Generated from source location line 113, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RDisplayView
Runtime view for objects implementing RDisplay. Generated from source location line 113, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RErrorVTable 👻
Vtable for the RError trait. Generated from source location line 298, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RErrorView
Runtime view for objects implementing RError. Generated from source location line 298, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RExtendVTable 👻
Vtable for the RExtend trait. Generated from source location line 778, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RFromIterVTable 👻
Vtable for the RFromIter trait. Generated from source location line 845, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RFromStrVTable 👻
Vtable for the RFromStr trait. Generated from source location line 363, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RFromStrView
Runtime view for objects implementing RFromStr. Generated from source location line 363, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RHashVTable 👻
Vtable for the RHash trait. Generated from source location line 156, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RHashView
Runtime view for objects implementing RHash. Generated from source location line 156, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RIteratorVTable 👻
Vtable for the RIterator trait. Generated from source location line 601, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RIteratorView
Runtime view for objects implementing RIterator. Generated from source location line 601, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RMakeIterVTable 👻
Vtable for the RMakeIter trait. Generated from source location line 1001, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
ROrdVTable 👻
Vtable for the ROrd trait. Generated from source location line 195, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
ROrdView
Runtime view for objects implementing ROrd. Generated from source location line 195, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RPartialOrdVTable 👻
Vtable for the RPartialOrd trait. Generated from source location line 237, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RPartialOrdView
Runtime view for objects implementing RPartialOrd. Generated from source location line 237, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
RToVecVTable 👻
Vtable for the RToVec trait. Generated from source location line 915, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.

Constants§

TAG_RClone
Type tag for runtime identification of the RClone trait. Generated from source location line 404, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RCopy
Type tag for runtime identification of the RCopy trait. Generated from source location line 493, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RDebug
Type tag for runtime identification of the RDebug trait. Generated from source location line 71, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RDefault
Type tag for runtime identification of the RDefault trait. Generated from source location line 445, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RDisplay
Type tag for runtime identification of the RDisplay trait. Generated from source location line 113, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RError
Type tag for runtime identification of the RError trait. Generated from source location line 298, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RExtend
Type tag for runtime identification of the RExtend trait. Generated from source location line 778, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RFromIter
Type tag for runtime identification of the RFromIter trait. Generated from source location line 845, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RFromStr
Type tag for runtime identification of the RFromStr trait. Generated from source location line 363, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RHash
Type tag for runtime identification of the RHash trait. Generated from source location line 156, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RIterator
Type tag for runtime identification of the RIterator trait. Generated from source location line 601, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RMakeIter
Type tag for runtime identification of the RMakeIter trait. Generated from source location line 1001, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_ROrd
Type tag for runtime identification of the ROrd trait. Generated from source location line 195, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RPartialOrd
Type tag for runtime identification of the RPartialOrd trait. Generated from source location line 237, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
TAG_RToVec
Type tag for runtime identification of the RToVec trait. Generated from source location line 915, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.

Traits§

RClone
Adapter trait for std::clone::Clone.
RCopy
Adapter trait for std::marker::Copy.
RDebug
Adapter trait for std::fmt::Debug.
RDefault
Adapter trait for std::default::Default.
RDisplay
Adapter trait for std::fmt::Display.
RError
Adapter trait for std::error::Error.
RExtend
Adapter trait for std::iter::Extend.
RFromIter
Adapter trait for std::iter::FromIterator.
RFromStr
Adapter trait for std::str::FromStr.
RHash
Adapter trait for std::hash::Hash.
RIterator
Adapter trait for std::iter::Iterator.
RMakeIter
Adapter trait for creating iterator wrappers from collections.
ROrd
Adapter trait for std::cmp::Ord.
RPartialOrd
Adapter trait for std::cmp::PartialOrd.
RToVec
Adapter trait for collections that can be converted to vectors.

Functions§

__RClone_build_vtable
Build a vtable for a concrete type implementing RClone. Generated from source location line 404, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RCopy_build_vtable
Build a vtable for a concrete type implementing RCopy. Generated from source location line 493, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RDebug_build_vtable
Build a vtable for a concrete type implementing RDebug. Generated from source location line 71, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RDefault_build_vtable
Build a vtable for a concrete type implementing RDefault. Generated from source location line 445, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RDisplay_build_vtable
Build a vtable for a concrete type implementing RDisplay. Generated from source location line 113, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RError_build_vtable
Build a vtable for a concrete type implementing RError. Generated from source location line 298, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RFromStr_build_vtable
Build a vtable for a concrete type implementing RFromStr. Generated from source location line 363, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RHash_build_vtable
Build a vtable for a concrete type implementing RHash. Generated from source location line 156, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RIterator_build_vtable
Build a vtable for a concrete type implementing RIterator. Generated from source location line 601, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__ROrd_build_vtable
Build a vtable for a concrete type implementing ROrd. Generated from source location line 195, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.
__RPartialOrd_build_vtable
Build a vtable for a concrete type implementing RPartialOrd. Generated from source location line 237, column 11. Generated from source file miniextendr-api/src/adapter_traits.rs.