Skip to content

Instantly share code, notes, and snippets.

@wycats
Created May 28, 2014 00:44
Show Gist options
  • Save wycats/018c9c2e2687aa94d667 to your computer and use it in GitHub Desktop.
Save wycats/018c9c2e2687aa94d667 to your computer and use it in GitHub Desktop.
extern crate term;
use term::Terminal;
enum AdequateTerminal<T> {
Color(Box<Terminal<T>>)
}
struct Shell<T> {
terminal: AdequateTerminal<T>
}
impl <T: Writer + Send> Shell<T> {
fn create(out: T) -> Option<Shell<T>> {
let term: Option<term::TerminfoTerminal<T>> = Terminal::new(out);
term.map(|t: term::TerminfoTerminal<T>| Shell { terminal: Color(box t as Box<Terminal<T>>) })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment