Skip to main content

AsList

Trait AsList 

Source
pub trait AsList {
    // Required method
    fn as_list(&self) -> Result<List, AsCoerceError>;
}
Expand description

Trait for types that can be coerced to list via as.list().

§Example

impl AsList for MyStruct {
    fn as_list(&self) -> Result<List, AsCoerceError> {
        Ok(List::from_pairs(vec![
            ("field1", self.field1.clone()),
            ("field2", self.field2.clone()),
        ]))
    }
}

Required Methods§

Source

fn as_list(&self) -> Result<List, AsCoerceError>

Convert to an R list.

Implementors§