readline - Does rust 0.10 have a rl package? -


i'm starting use rust create little toy command prompt applicationusing gnu readline library. started using c foreign function interface came across in rust 0.8.

the crate has module extra::rl appears readline tools needed. question is, present in rust 0.10 , if it? if not, packaged external module, , if can find it?

thanks in advance.

use std::c_str;  #[link(name = "readline")] extern {     fn readline (p: *std::libc::c_char) -> * std::libc::c_char; }  fn rust_readline (prompt: &str) -> option<~str> {     let cprmt = prompt.to_c_str();     cprmt.with_ref(|c_buf| {     unsafe {         let ret = c_str::cstring::new (readline (c_buf), true);         ret.as_str().map(|ret| ret.to_owned())     }     }) }  fn eval(input: &str) {     println! ("{}", input); }  fn main() {     loop {         let val = rust_readline (">>> ");         match val {             none => { break }             _ => {                 let input = val.unwrap ();                 eval(input);             }         }     } } 

this sample repl style interpreter prints instead of eval'ing. based on code http://redbrain.co.uk/2013/11/09/rust-and-readline-c-ffi/. example no longer compiles.

this code on github here.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -