summaryrefslogtreecommitdiffstats
path: root/src/cell.rs
diff options
context:
space:
mode:
authorAlexander Bulaev <alexbool@yandex-team.ru>2016-01-11 22:57:36 +0300
committerAlexander Bulaev <alexbool@yandex-team.ru>2016-01-11 22:57:36 +0300
commit6cd4e409d11c3bf3b4446682c4d2a3750041830f (patch)
tree7873f675dd085e867978d223182c28fd20cdd756 /src/cell.rs
parent3f5611d530782d29fbccd89fe0f79a9e8420a167 (diff)
Bump term to 0.4
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 61bd0d5..7032a7b 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -187,14 +187,21 @@ impl Cell {
/// Apply style then call `print` to print the cell into a terminal
pub fn print_term<T: Terminal+?Sized>(&self, out: &mut T, idx: usize, col_width: usize) -> Result<(), Error> {
for a in &self.style {
- try!(out.attr(a.clone()));
+ try!(out.attr(a.clone()).map_err(term_error_to_io_error));
}
try!(self.print(out, idx, col_width));
- try!(out.reset());
+ try!(out.reset().map_err(term_error_to_io_error));
return Ok(());
}
}
+fn term_error_to_io_error(te: ::term::Error) -> Error {
+ match te {
+ ::term::Error::Io(why) => why,
+ _ => Error::new(::std::io::ErrorKind::Other, te),
+ }
+}
+
impl <'a, T: ToString> From<&'a T> for Cell {
fn from(f: &T) -> Cell {
return Cell::new(&f.to_string());