1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use unjson::ty::Object; use easter::prog::Script; use result::Result; use node::ExtractNode; pub trait IntoScript { fn into_script(self) -> Result<Script>; } impl IntoScript for Object { fn into_script(mut self) -> Result<Script> { let body = try!(self.extract_stmt_list("body")); Ok(Script { location: None, body: body }) } }