Upgrade to 2018 edition

This commit is contained in:
Sven-Hendrik Haase 2019-01-06 12:57:06 +01:00 committed by Florian Dehau
parent 3fd9e23851
commit 144bfb71cf
46 changed files with 107 additions and 216 deletions

View File

@ -1,6 +1,8 @@
# Changelog # Changelog
## To be released ## v0.3.1 - To be released
* Upgraded to Rust 2018 edition
## v0.3.0 - 2018-11-04 ## v0.3.0 - 2018-11-04

View File

@ -10,6 +10,7 @@ repository = "https://github.com/fdehau/tui-rs"
license = "MIT" license = "MIT"
exclude = ["assets/*", ".travis.yml"] exclude = ["assets/*", ".travis.yml"]
autoexamples = true autoexamples = true
edition = "2018"
[badges] [badges]
travis-ci = { repository = "fdehau/tui-rs" } travis-ci = { repository = "fdehau/tui-rs" }

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{BarChart, Block, Borders, Widget}; use tui::widgets::{BarChart, Block, Borders, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
struct App<'a> { struct App<'a> {
data: Vec<(&'a str, u64)>, data: Vec<(&'a str, u64)>,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -16,7 +12,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Widget}; use tui::widgets::{Block, Borders, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
fn main() -> Result<(), failure::Error> { fn main() -> Result<(), failure::Error> {
// Terminal initialization // Terminal initialization

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -19,7 +15,7 @@ use tui::widgets::canvas::{Canvas, Line, Map, MapResolution};
use tui::widgets::{Block, Borders, Widget}; use tui::widgets::{Block, Borders, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Config, Event, Events}; use crate::util::event::{Config, Event, Events};
struct App { struct App {
x: f64, x: f64,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -16,8 +12,8 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Widget}; use tui::widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
use util::SinSignal; use crate::util::SinSignal;
struct App { struct App {
signal1: SinSignal, signal1: SinSignal,

View File

@ -1,7 +1,3 @@
extern crate crossterm;
extern crate failure;
extern crate tui;
use tui::backend::CrosstermBackend; use tui::backend::CrosstermBackend;
use tui::style::{Color, Modifier, Style}; use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Paragraph, Text, Widget}; use tui::widgets::{Block, Borders, Paragraph, Text, Widget};

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -18,7 +14,7 @@ use tui::style::Style;
use tui::widgets::Widget; use tui::widgets::Widget;
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
struct Label<'a> { struct Label<'a> {
text: &'a str, text: &'a str,

View File

@ -1,9 +1,3 @@
extern crate failure;
extern crate log;
extern crate stderrlog;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -23,8 +17,8 @@ use tui::widgets::{
}; };
use tui::{Frame, Terminal}; use tui::{Frame, Terminal};
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
use util::{RandomSignal, SinSignal, TabsState}; use crate::util::{RandomSignal, SinSignal, TabsState};
struct Server<'a> { struct Server<'a> {
name: &'a str, name: &'a str,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Gauge, Widget}; use tui::widgets::{Block, Borders, Gauge, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
struct App { struct App {
progress1: u16, progress1: u16,

View File

@ -1,9 +1,3 @@
extern crate failure;
extern crate log;
extern crate stderrlog;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -18,7 +12,7 @@ use tui::layout::{Constraint, Direction, Layout};
use tui::widgets::{Block, Borders, Widget}; use tui::widgets::{Block, Borders, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
fn main() -> Result<(), failure::Error> { fn main() -> Result<(), failure::Error> {
stderrlog::new().verbosity(4).init()?; stderrlog::new().verbosity(4).init()?;

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, List, SelectableList, Text, Widget}; use tui::widgets::{Block, Borders, List, SelectableList, Text, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
struct App<'a> { struct App<'a> {
items: Vec<&'a str>, items: Vec<&'a str>,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Paragraph, Text, Widget}; use tui::widgets::{Block, Borders, Paragraph, Text, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
fn main() -> Result<(), failure::Error> { fn main() -> Result<(), failure::Error> {
// Terminal initialization // Terminal initialization

View File

@ -1,6 +1,3 @@
extern crate rustbox;
extern crate tui;
use rustbox::Key; use rustbox::Key;
use std::error::Error; use std::error::Error;

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,8 +13,8 @@ use tui::style::{Color, Style};
use tui::widgets::{Block, Borders, Sparkline, Widget}; use tui::widgets::{Block, Borders, Sparkline, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
use util::RandomSignal; use crate::util::RandomSignal;
struct App { struct App {
signal: RandomSignal, signal: RandomSignal,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Row, Table, Widget}; use tui::widgets::{Block, Borders, Row, Table, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
struct App<'a> { struct App<'a> {
items: Vec<Vec<&'a str>>, items: Vec<Vec<&'a str>>,

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -17,8 +13,8 @@ use tui::style::{Color, Style};
use tui::widgets::{Block, Borders, Tabs, Widget}; use tui::widgets::{Block, Borders, Tabs, Widget};
use tui::Terminal; use tui::Terminal;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
use util::TabsState; use crate::util::TabsState;
struct App<'a> { struct App<'a> {
tabs: TabsState<'a>, tabs: TabsState<'a>,

View File

@ -1,4 +1,3 @@
extern crate failure;
/// A simple example demonstrating how to handle user input. This is /// A simple example demonstrating how to handle user input. This is
/// a bit out of the scope of the library as it does not provide any /// a bit out of the scope of the library as it does not provide any
/// input handling out of the box. However, it may helps some to get /// input handling out of the box. However, it may helps some to get
@ -10,9 +9,6 @@ extern crate failure;
/// * Pressing Backspace erases a character /// * Pressing Backspace erases a character
/// * Pressing Enter pushes the current input in the history of previous /// * Pressing Enter pushes the current input in the history of previous
/// messages /// messages
extern crate termion;
extern crate tui;
extern crate unicode_width;
#[allow(dead_code)] #[allow(dead_code)]
mod util; mod util;
@ -31,7 +27,7 @@ use tui::widgets::{Block, Borders, List, Paragraph, Text, Widget};
use tui::Terminal; use tui::Terminal;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use util::event::{Event, Events}; use crate::util::event::{Event, Events};
/// App holds the state of the application /// App holds the state of the application
struct App { struct App {

View File

@ -1,9 +1,7 @@
extern crate rand;
pub mod event; pub mod event;
use self::rand::distributions::{Distribution, Uniform}; use rand::distributions::{Distribution, Uniform};
use self::rand::rngs::ThreadRng; use rand::rngs::ThreadRng;
#[derive(Clone)] #[derive(Clone)]
pub struct RandomSignal { pub struct RandomSignal {

View File

@ -1,11 +1,9 @@
extern crate crossterm;
use std::io; use std::io;
use backend::Backend; use crate::backend::Backend;
use buffer::Cell; use crate::buffer::Cell;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Modifier}; use crate::style::{Color, Modifier};
pub struct CrosstermBackend { pub struct CrosstermBackend {
screen: crossterm::Screen, screen: crossterm::Screen,

View File

@ -1,7 +1,7 @@
use std::io; use std::io;
use buffer::Cell; use crate::buffer::Cell;
use layout::Rect; use crate::layout::Rect;
#[cfg(feature = "rustbox")] #[cfg(feature = "rustbox")]
mod rustbox; mod rustbox;

View File

@ -1,11 +1,10 @@
extern crate rustbox; use log::debug;
use std::io; use std::io;
use super::Backend; use super::Backend;
use buffer::Cell; use crate::buffer::Cell;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Modifier}; use crate::style::{Color, Modifier};
pub struct RustboxBackend { pub struct RustboxBackend {
rustbox: rustbox::RustBox, rustbox: rustbox::RustBox,
@ -13,7 +12,7 @@ pub struct RustboxBackend {
impl RustboxBackend { impl RustboxBackend {
pub fn new() -> Result<RustboxBackend, rustbox::InitError> { pub fn new() -> Result<RustboxBackend, rustbox::InitError> {
let rustbox = try!(rustbox::RustBox::init(Default::default())); let rustbox = r#try!(rustbox::RustBox::init(Default::default()));
Ok(RustboxBackend { rustbox: rustbox }) Ok(RustboxBackend { rustbox: rustbox })
} }

View File

@ -1,12 +1,11 @@
extern crate termion; use log::debug;
use std::io; use std::io;
use std::io::Write; use std::io::Write;
use super::Backend; use super::Backend;
use buffer::Cell; use crate::buffer::Cell;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Modifier, Style}; use crate::style::{Color, Modifier, Style};
pub struct TermionBackend<W> pub struct TermionBackend<W>
where where
@ -111,7 +110,7 @@ where
/// Return the size of the terminal /// Return the size of the terminal
fn size(&self) -> io::Result<Rect> { fn size(&self) -> io::Result<Rect> {
let terminal = try!(termion::terminal_size()); let terminal = r#try!(termion::terminal_size());
Ok(Rect::new(0, 0, terminal.0, terminal.1)) Ok(Rect::new(0, 0, terminal.0, terminal.1))
} }

View File

@ -5,8 +5,8 @@ use std::usize;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Modifier, Style}; use crate::style::{Color, Modifier, Style};
/// A buffer cell /// A buffer cell
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
@ -74,7 +74,6 @@ impl Default for Cell {
/// # Examples: /// # Examples:
/// ///
/// ``` /// ```
/// # extern crate tui;
/// use tui::buffer::{Buffer, Cell}; /// use tui::buffer::{Buffer, Cell};
/// use tui::layout::Rect; /// use tui::layout::Rect;
/// use tui::style::{Color, Style, Modifier}; /// use tui::style::{Color, Style, Modifier};

View File

@ -82,7 +82,6 @@ impl Layout {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # extern crate tui;
/// # use tui::layout::{Rect, Constraint, Direction, Layout}; /// # use tui::layout::{Rect, Constraint, Direction, Layout};
/// ///
/// # fn main() { /// # fn main() {

View File

@ -13,9 +13,6 @@
//! backend is available. //! backend is available.
//! //!
//! ```rust,no_run //! ```rust,no_run
//! extern crate tui;
//! extern crate termion;
//!
//! use std::io; //! use std::io;
//! use tui::Terminal; //! use tui::Terminal;
//! use tui::backend::TermionBackend; //! use tui::backend::TermionBackend;
@ -42,7 +39,6 @@
//! and then create the terminal in a similar way: //! and then create the terminal in a similar way:
//! //!
//! ```rust,ignore //! ```rust,ignore
//! extern crate tui;
//! //!
//! use tui::Terminal; //! use tui::Terminal;
//! use tui::backend::RustboxBackend; //! use tui::backend::RustboxBackend;
@ -68,8 +64,6 @@
//! The following example renders a block of the size of the terminal: //! The following example renders a block of the size of the terminal:
//! //!
//! ```rust,no_run //! ```rust,no_run
//! extern crate tui;
//! extern crate termion;
//! //!
//! use std::io; //! use std::io;
//! use termion::raw::IntoRawMode; //! use termion::raw::IntoRawMode;
@ -99,8 +93,6 @@
//! full customization. And `Layout` is no exception: //! full customization. And `Layout` is no exception:
//! //!
//! ```rust,no_run //! ```rust,no_run
//! extern crate tui;
//! extern crate termion;
//! //!
//! use std::io; //! use std::io;
//! use termion::raw::IntoRawMode; //! use termion::raw::IntoRawMode;
@ -142,16 +134,6 @@
//! completely. So if for any reason you might need a blank space somewhere, try to //! completely. So if for any reason you might need a blank space somewhere, try to
//! pass an additional constraint and don't use the corresponding area. //! pass an additional constraint and don't use the corresponding area.
#[macro_use]
extern crate bitflags;
extern crate cassowary;
extern crate either;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate unicode_segmentation;
extern crate unicode_width;
pub mod backend; pub mod backend;
pub mod buffer; pub mod buffer;
pub mod layout; pub mod layout;

View File

@ -1,9 +1,10 @@
use log::error;
use std::io; use std::io;
use backend::Backend; use crate::backend::Backend;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use widgets::Widget; use crate::widgets::Widget;
/// Interface to the terminal backed by Termion /// Interface to the terminal backed by Termion
#[derive(Debug)] #[derive(Debug)]

View File

@ -2,18 +2,17 @@ use std::cmp::{max, min};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use symbols::bar; use crate::symbols::bar;
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
/// Display multiple bars in a single widgets /// Display multiple bars in a single widgets
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, BarChart}; /// # use tui::widgets::{Block, Borders, BarChart};
/// # use tui::style::{Style, Color, Modifier}; /// # use tui::style::{Style, Color, Modifier};
/// # fn main() { /// # fn main() {

View File

@ -1,8 +1,8 @@
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use symbols::line; use crate::symbols::line;
use widgets::{Borders, Widget}; use crate::widgets::{Borders, Widget};
/// Base widget to be used with all upper level ones. It may be used to display a box border around /// Base widget to be used with all upper level ones. It may be used to display a box border around
/// the widget and/or add a title. /// the widget and/or add a title.
@ -10,7 +10,6 @@ use widgets::{Borders, Widget};
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders}; /// # use tui::widgets::{Block, Borders};
/// # use tui::style::{Style, Color}; /// # use tui::style::{Style, Color};
/// # fn main() { /// # fn main() {

View File

@ -1,5 +1,5 @@
use super::Shape; use super::Shape;
use style::Color; use crate::style::Color;
/// Shape to draw a line from (x1, y1) to (x2, y2) with the given color /// Shape to draw a line from (x1, y1) to (x2, y2) with the given color
pub struct Line { pub struct Line {

View File

@ -1,7 +1,7 @@
use style::Color; use crate::style::Color;
use widgets::canvas::points::PointsIterator; use crate::widgets::canvas::points::PointsIterator;
use widgets::canvas::world::{WORLD_HIGH_RESOLUTION, WORLD_LOW_RESOLUTION}; use crate::widgets::canvas::world::{WORLD_HIGH_RESOLUTION, WORLD_LOW_RESOLUTION};
use widgets::canvas::Shape; use crate::widgets::canvas::Shape;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub enum MapResolution { pub enum MapResolution {

View File

@ -7,10 +7,10 @@ pub use self::line::Line;
pub use self::map::{Map, MapResolution}; pub use self::map::{Map, MapResolution};
pub use self::points::Points; pub use self::points::Points;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Style}; use crate::style::{Color, Style};
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
pub const DOTS: [[u16; 2]; 4] = [ pub const DOTS: [[u16; 2]; 4] = [
[0x0001, 0x0008], [0x0001, 0x0008],
@ -132,7 +132,6 @@ impl<'a> Context<'a> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders}; /// # use tui::widgets::{Block, Borders};
/// # use tui::widgets::canvas::{Canvas, Shape, Line, Map, MapResolution}; /// # use tui::widgets::canvas::{Canvas, Shape, Line, Map, MapResolution};
/// # use tui::style::Color; /// # use tui::style::Color;

View File

@ -1,7 +1,7 @@
use std::slice; use std::slice;
use super::Shape; use super::Shape;
use style::Color; use crate::style::Color;
/// A shape to draw a group of points with the given color /// A shape to draw a group of points with the given color
pub struct Points<'a> { pub struct Points<'a> {

View File

@ -2,12 +2,12 @@ use std::cmp::max;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use symbols; use crate::symbols;
use widgets::canvas::{Canvas, Points}; use crate::widgets::canvas::{Canvas, Points};
use widgets::{Block, Borders, Widget}; use crate::widgets::{Block, Borders, Widget};
/// An X or Y axis for the chart widget /// An X or Y axis for the chart widget
pub struct Axis<'a, L> pub struct Axis<'a, L>
@ -166,7 +166,6 @@ impl Default for ChartLayout {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, Chart, Axis, Dataset, Marker}; /// # use tui::widgets::{Block, Borders, Chart, Axis, Dataset, Marker};
/// # use tui::style::{Style, Color}; /// # use tui::style::{Style, Color};
/// # fn main() { /// # fn main() {

View File

@ -1,16 +1,15 @@
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Style}; use crate::style::{Color, Style};
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
/// A widget to display a task progress. /// A widget to display a task progress.
/// ///
/// # Examples: /// # Examples:
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Widget, Gauge, Block, Borders}; /// # use tui::widgets::{Widget, Gauge, Block, Borders};
/// # use tui::style::{Style, Color, Modifier}; /// # use tui::style::{Style, Color, Modifier};
/// # fn main() { /// # fn main() {

View File

@ -3,10 +3,10 @@ use std::iter::Iterator;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::{Corner, Rect}; use crate::layout::{Corner, Rect};
use style::Style; use crate::style::Style;
use widgets::{Block, Text, Widget}; use crate::widgets::{Block, Text, Widget};
pub struct List<'b, L> pub struct List<'b, L>
where where
@ -117,7 +117,6 @@ where
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, SelectableList}; /// # use tui::widgets::{Block, Borders, SelectableList};
/// # use tui::style::{Style, Color, Modifier}; /// # use tui::style::{Style, Color, Modifier};
/// # fn main() { /// # fn main() {

View File

@ -1,3 +1,4 @@
use bitflags::bitflags;
use std::borrow::Cow; use std::borrow::Cow;
mod barchart; mod barchart;
@ -22,11 +23,11 @@ pub use self::sparkline::Sparkline;
pub use self::table::{Row, Table}; pub use self::table::{Row, Table};
pub use self::tabs::Tabs; pub use self::tabs::Tabs;
use backend::Backend; use crate::backend::Backend;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::{Color, Style}; use crate::style::{Color, Style};
use terminal::Frame; use crate::terminal::Frame;
/// Bitflags that can be composed to set the visible borders essentially on the block widget. /// Bitflags that can be composed to set the visible borders essentially on the block widget.
bitflags! { bitflags! {

View File

@ -2,11 +2,11 @@ use either::Either;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::{Alignment, Rect}; use crate::layout::{Alignment, Rect};
use style::Style; use crate::style::Style;
use widgets::reflow::{LineComposer, LineTruncator, Styled, WordWrapper}; use crate::widgets::reflow::{LineComposer, LineTruncator, Styled, WordWrapper};
use widgets::{Block, Text, Widget}; use crate::widgets::{Block, Text, Widget};
fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment) -> u16 { fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment) -> u16 {
match alignment { match alignment {
@ -21,7 +21,6 @@ fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment)
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, Paragraph, Text}; /// # use tui::widgets::{Block, Borders, Paragraph, Text};
/// # use tui::style::{Style, Color}; /// # use tui::style::{Style, Color};
/// # use tui::layout::{Alignment}; /// # use tui::layout::{Alignment};

View File

@ -1,4 +1,4 @@
use style::Style; use crate::style::Style;
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
const NBSP: &str = "\u{00a0}"; const NBSP: &str = "\u{00a0}";

View File

@ -1,17 +1,16 @@
use std::cmp::min; use std::cmp::min;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use symbols::bar; use crate::symbols::bar;
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
/// Widget to render a sparkline over one or more lines. /// Widget to render a sparkline over one or more lines.
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, Sparkline}; /// # use tui::widgets::{Block, Borders, Sparkline};
/// # use tui::style::{Style, Color}; /// # use tui::style::{Style, Color};
/// # fn main() { /// # fn main() {

View File

@ -1,10 +1,10 @@
use std::fmt::Display; use std::fmt::Display;
use std::iter::Iterator; use std::iter::Iterator;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
/// Holds data to be displayed in a Table widget /// Holds data to be displayed in a Table widget
pub enum Row<D, I> pub enum Row<D, I>

View File

@ -1,17 +1,16 @@
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
use buffer::Buffer; use crate::buffer::Buffer;
use layout::Rect; use crate::layout::Rect;
use style::Style; use crate::style::Style;
use symbols::line; use crate::symbols::line;
use widgets::{Block, Widget}; use crate::widgets::{Block, Widget};
/// A widget to display available tabs in a multiple panels context. /// A widget to display available tabs in a multiple panels context.
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # extern crate tui;
/// # use tui::widgets::{Block, Borders, Tabs}; /// # use tui::widgets::{Block, Borders, Tabs};
/// # use tui::style::{Style, Color}; /// # use tui::style::{Style, Color};
/// # fn main() { /// # fn main() {

View File

@ -1,6 +1,3 @@
extern crate tui;
extern crate unicode_width;
use tui::backend::TestBackend; use tui::backend::TestBackend;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::Rect; use tui::layout::Rect;

View File

@ -1,6 +1,3 @@
extern crate tui;
extern crate unicode_width;
use tui::backend::TestBackend; use tui::backend::TestBackend;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::{Constraint, Direction, Layout}; use tui::layout::{Constraint, Direction, Layout};

View File

@ -1,7 +1,3 @@
extern crate failure;
extern crate termion;
extern crate tui;
use tui::backend::TestBackend; use tui::backend::TestBackend;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::Alignment; use tui::layout::Alignment;

View File

@ -1,5 +1,3 @@
extern crate tui;
use tui::backend::{Backend, TestBackend}; use tui::backend::{Backend, TestBackend};
use tui::Terminal; use tui::Terminal;