pub struct AsList<T: IntoList>(pub T);Expand description
Wrap a value and convert it to an R list via IntoList when returned from Rust.
Use this wrapper when you want to convert a single value to an R list without making that the default behavior for the type.
§Example
ⓘ
#[derive(IntoList)]
struct Point { x: f64, y: f64 }
#[miniextendr]
fn make_point() -> AsList<Point> {
AsList(Point { x: 1.0, y: 2.0 })
}
// In R: make_point() returns list(x = 1.0, y = 2.0)Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: IntoList> IntoR for AsList<T>
impl<T: IntoList> IntoR for AsList<T>
Source§type Error = Infallible
type Error = Infallible
The error type for fallible conversions. Read more
Source§fn try_into_sexp(self) -> Result<SEXP, Self::Error>
fn try_into_sexp(self) -> Result<SEXP, Self::Error>
Try to convert this value to an R SEXP. Read more
impl<T: Copy + IntoList> Copy for AsList<T>
Auto Trait Implementations§
impl<T> Freeze for AsList<T>where
T: Freeze,
impl<T> RefUnwindSafe for AsList<T>where
T: RefUnwindSafe,
impl<T> Send for AsList<T>where
T: Send,
impl<T> Sync for AsList<T>where
T: Sync,
impl<T> Unpin for AsList<T>where
T: Unpin,
impl<T> UnsafeUnpin for AsList<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for AsList<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more