Struct extendr_api::wrapper::Func[][src]

pub struct Func<F, B, E> {
    pub formals: F,
    pub body: B,
    pub env: E,
}

Wrapper for creating functions (CLOSSXP).

use extendr_api::prelude::*;
test! {
    let expr = R!(function(a = 1, b) {c <- a + b}).unwrap();
    let func = expr.as_func().unwrap();

    let expected_formals = Pairlist {
        names_and_values: vec![("a", r!(1.0)), ("b", missing_arg())] };
    let expected_body = lang!(
        "{", lang!("<-", sym!(c), lang!("+", sym!(a), sym!(b))));
    assert_eq!(func.formals.as_pairlist().unwrap(), expected_formals);
    assert_eq!(func.body, expected_body);
    assert_eq!(func.env, global_env());
}

Fields

formals: Fbody: Benv: E

Trait Implementations

impl<F: Clone, B: Clone, E: Clone> Clone for Func<F, B, E>[src]

impl<F: Debug, B: Debug, E: Debug> Debug for Func<F, B, E>[src]

impl<F: PartialEq, B: PartialEq, E: PartialEq> PartialEq<Func<F, B, E>> for Func<F, B, E>[src]

impl<F, B, E> StructuralPartialEq for Func<F, B, E>[src]

Auto Trait Implementations

impl<F, B, E> RefUnwindSafe for Func<F, B, E> where
    B: RefUnwindSafe,
    E: RefUnwindSafe,
    F: RefUnwindSafe
[src]

impl<F, B, E> Send for Func<F, B, E> where
    B: Send,
    E: Send,
    F: Send
[src]

impl<F, B, E> Sync for Func<F, B, E> where
    B: Sync,
    E: Sync,
    F: Sync
[src]

impl<F, B, E> Unpin for Func<F, B, E> where
    B: Unpin,
    E: Unpin,
    F: Unpin
[src]

impl<F, B, E> UnwindSafe for Func<F, B, E> where
    B: UnwindSafe,
    E: UnwindSafe,
    F: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.