[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Bring up to date with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mkpankov committed Mar 22, 2015
1 parent a800874 commit 00eed7d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
extern crate term;

use std::io::Write;
use State::{Beginning, Tag, Inside, InsideColor, InsideBool};
use Token::{Attribute,
Reset,
Literal,
Partial,
};
use term::{StdTerminal, Attr};
use term::{StdoutTerminal, Attr};
pub use term::Attr::{
Bold,
Dim,
Expand Down Expand Up @@ -40,9 +41,9 @@ pub use term::color::{
YELLOW,
};

pub type FullTerminal = Box<StdTerminal>;
pub type FullTerminal = Box<StdoutTerminal>;

#[derive(Show)]
#[derive(Debug)]
enum State {
Beginning,
Tag,
Expand All @@ -51,7 +52,7 @@ enum State {
InsideBool,
}

#[derive(Copy, Show, PartialEq, Eq)]
#[derive(Copy, Debug, PartialEq, Eq)]
pub enum PartialToken {
Fg,
Bg,
Expand All @@ -60,7 +61,7 @@ pub enum PartialToken {
Standout,
}

#[derive(Show, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub enum Token {
Partial(PartialToken),
Attribute(Attr),
Expand Down Expand Up @@ -280,7 +281,9 @@ fn get_color_by_name(color: &str) -> Result<Color, String> {
pub fn render(trm: &mut FullTerminal, tokens: &[Token]) {
for t in tokens.iter() {
match *t {
Literal(ref string) => write!(trm, "{}", string).unwrap(),
Literal(ref string) => {
write!(trm, "{}", string).unwrap();
}
Attribute(value) => {
trm.attr(value).unwrap();
}
Expand Down

0 comments on commit 00eed7d

Please sign in to comment.