Created
April 6, 2016 21:05
-
-
Save saptarshiguha/cf94b7b50703b40ff609f4fe623122a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[derive(Debug)] | |
| pub enum RRustError { | |
| ConversionError, | |
| } | |
| type convertError<T> = Result<T, RRustError>; | |
| pub trait Robject { | |
| fn l(&self) -> isize; | |
| fn toSexp(&self) -> rRinternal::SEXP ; | |
| fn t(&self) -> i32; | |
| fn fromSEXP<T>(r: rRinternal::SEXP) -> convertError<T> ; | |
| } | |
| #[derive(Debug,Clone)] | |
| pub struct Rnull; | |
| impl Rnull { | |
| pub fn create() -> Rnull { | |
| Rnull | |
| } | |
| } | |
| impl Robject for Rnull { | |
| fn t(&self) -> i32 { | |
| return NILSXP; | |
| } | |
| fn toSexp(&self) -> rRinternal::SEXP { | |
| unsafe { | |
| return rRinternal::R_NilValue; | |
| } | |
| } | |
| fn l(&self) -> isize { | |
| return 0; | |
| } | |
| fn fromSEXP<Rnull>(r: rRinternal::SEXP) -> convertError<Rnull> { | |
| return Ok(Rnull::create()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment