Created
May 28, 2014 00:39
-
-
Save wycats/448929151c664dffde5d 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
extern crate term; | |
use term::Terminal; | |
struct ShellConfig { | |
color: int, | |
verbose: int, | |
tty: bool, | |
} | |
enum AdequateTerminal<T> { | |
Color(Box<Terminal<T>>) | |
} | |
struct Shell<T> { | |
terminal: AdequateTerminal<T>, | |
config: ShellConfig, | |
} | |
impl <T: Writer + Send> Shell<T> { | |
fn create(out: T, config: ShellConfig) -> Option<Shell<T>> { | |
let term: Option<term::TerminfoTerminal<T>> = Terminal::new(out); | |
term.map(|t: term::TerminfoTerminal<T>| Shell { terminal: Color(box t), config: config }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment