mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
Upgrade to 2018 edition
This commit is contained in:
parent
3fd9e23851
commit
144bfb71cf
46 changed files with 107 additions and 216 deletions
|
@ -1,6 +1,8 @@
|
|||
# Changelog
|
||||
|
||||
## To be released
|
||||
## v0.3.1 - To be released
|
||||
|
||||
* Upgraded to Rust 2018 edition
|
||||
|
||||
## v0.3.0 - 2018-11-04
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ repository = "https://github.com/fdehau/tui-rs"
|
|||
license = "MIT"
|
||||
exclude = ["assets/*", ".travis.yml"]
|
||||
autoexamples = true
|
||||
edition = "2018"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "fdehau/tui-rs" }
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{BarChart, Block, Borders, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
struct App<'a> {
|
||||
data: Vec<(&'a str, u64)>,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -16,7 +12,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Block, Borders, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
fn main() -> Result<(), failure::Error> {
|
||||
// Terminal initialization
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -19,7 +15,7 @@ use tui::widgets::canvas::{Canvas, Line, Map, MapResolution};
|
|||
use tui::widgets::{Block, Borders, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Config, Event, Events};
|
||||
use crate::util::event::{Config, Event, Events};
|
||||
|
||||
struct App {
|
||||
x: f64,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -16,8 +12,8 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use util::SinSignal;
|
||||
use crate::util::event::{Event, Events};
|
||||
use crate::util::SinSignal;
|
||||
|
||||
struct App {
|
||||
signal1: SinSignal,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate crossterm;
|
||||
extern crate failure;
|
||||
extern crate tui;
|
||||
|
||||
use tui::backend::CrosstermBackend;
|
||||
use tui::style::{Color, Modifier, Style};
|
||||
use tui::widgets::{Block, Borders, Paragraph, Text, Widget};
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -18,7 +14,7 @@ use tui::style::Style;
|
|||
use tui::widgets::Widget;
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
struct Label<'a> {
|
||||
text: &'a str,
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate log;
|
||||
extern crate stderrlog;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -23,8 +17,8 @@ use tui::widgets::{
|
|||
};
|
||||
use tui::{Frame, Terminal};
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use util::{RandomSignal, SinSignal, TabsState};
|
||||
use crate::util::event::{Event, Events};
|
||||
use crate::util::{RandomSignal, SinSignal, TabsState};
|
||||
|
||||
struct Server<'a> {
|
||||
name: &'a str,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Block, Borders, Gauge, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
struct App {
|
||||
progress1: u16,
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate log;
|
||||
extern crate stderrlog;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -18,7 +12,7 @@ use tui::layout::{Constraint, Direction, Layout};
|
|||
use tui::widgets::{Block, Borders, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
fn main() -> Result<(), failure::Error> {
|
||||
stderrlog::new().verbosity(4).init()?;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Block, Borders, List, SelectableList, Text, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
struct App<'a> {
|
||||
items: Vec<&'a str>,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Block, Borders, Paragraph, Text, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
fn main() -> Result<(), failure::Error> {
|
||||
// Terminal initialization
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
extern crate rustbox;
|
||||
extern crate tui;
|
||||
|
||||
use rustbox::Key;
|
||||
use std::error::Error;
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,8 +13,8 @@ use tui::style::{Color, Style};
|
|||
use tui::widgets::{Block, Borders, Sparkline, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use util::RandomSignal;
|
||||
use crate::util::event::{Event, Events};
|
||||
use crate::util::RandomSignal;
|
||||
|
||||
struct App {
|
||||
signal: RandomSignal,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,7 +13,7 @@ use tui::style::{Color, Modifier, Style};
|
|||
use tui::widgets::{Block, Borders, Row, Table, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
struct App<'a> {
|
||||
items: Vec<Vec<&'a str>>,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
||||
|
@ -17,8 +13,8 @@ use tui::style::{Color, Style};
|
|||
use tui::widgets::{Block, Borders, Tabs, Widget};
|
||||
use tui::Terminal;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use util::TabsState;
|
||||
use crate::util::event::{Event, Events};
|
||||
use crate::util::TabsState;
|
||||
|
||||
struct App<'a> {
|
||||
tabs: TabsState<'a>,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
extern crate failure;
|
||||
/// 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
|
||||
/// 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 Enter pushes the current input in the history of previous
|
||||
/// messages
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
extern crate unicode_width;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod util;
|
||||
|
@ -31,7 +27,7 @@ use tui::widgets::{Block, Borders, List, Paragraph, Text, Widget};
|
|||
use tui::Terminal;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use util::event::{Event, Events};
|
||||
use crate::util::event::{Event, Events};
|
||||
|
||||
/// App holds the state of the application
|
||||
struct App {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
extern crate rand;
|
||||
|
||||
pub mod event;
|
||||
|
||||
use self::rand::distributions::{Distribution, Uniform};
|
||||
use self::rand::rngs::ThreadRng;
|
||||
use rand::distributions::{Distribution, Uniform};
|
||||
use rand::rngs::ThreadRng;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RandomSignal {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
extern crate crossterm;
|
||||
|
||||
use std::io;
|
||||
|
||||
use backend::Backend;
|
||||
use buffer::Cell;
|
||||
use layout::Rect;
|
||||
use style::{Color, Modifier};
|
||||
use crate::backend::Backend;
|
||||
use crate::buffer::Cell;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Modifier};
|
||||
|
||||
pub struct CrosstermBackend {
|
||||
screen: crossterm::Screen,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::io;
|
||||
|
||||
use buffer::Cell;
|
||||
use layout::Rect;
|
||||
use crate::buffer::Cell;
|
||||
use crate::layout::Rect;
|
||||
|
||||
#[cfg(feature = "rustbox")]
|
||||
mod rustbox;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
extern crate rustbox;
|
||||
|
||||
use log::debug;
|
||||
use std::io;
|
||||
|
||||
use super::Backend;
|
||||
use buffer::Cell;
|
||||
use layout::Rect;
|
||||
use style::{Color, Modifier};
|
||||
use crate::buffer::Cell;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Modifier};
|
||||
|
||||
pub struct RustboxBackend {
|
||||
rustbox: rustbox::RustBox,
|
||||
|
@ -13,7 +12,7 @@ pub struct RustboxBackend {
|
|||
|
||||
impl RustboxBackend {
|
||||
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 })
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
extern crate termion;
|
||||
|
||||
use log::debug;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
|
||||
use super::Backend;
|
||||
use buffer::Cell;
|
||||
use layout::Rect;
|
||||
use style::{Color, Modifier, Style};
|
||||
use crate::buffer::Cell;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Modifier, Style};
|
||||
|
||||
pub struct TermionBackend<W>
|
||||
where
|
||||
|
@ -111,7 +110,7 @@ where
|
|||
|
||||
/// Return the size of the terminal
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::usize;
|
|||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use layout::Rect;
|
||||
use style::{Color, Modifier, Style};
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Modifier, Style};
|
||||
|
||||
/// A buffer cell
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
@ -74,7 +74,6 @@ impl Default for Cell {
|
|||
/// # Examples:
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// use tui::buffer::{Buffer, Cell};
|
||||
/// use tui::layout::Rect;
|
||||
/// use tui::style::{Color, Style, Modifier};
|
||||
|
|
|
@ -82,7 +82,6 @@ impl Layout {
|
|||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::layout::{Rect, Constraint, Direction, Layout};
|
||||
///
|
||||
/// # fn main() {
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -13,9 +13,6 @@
|
|||
//! backend is available.
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! extern crate tui;
|
||||
//! extern crate termion;
|
||||
//!
|
||||
//! use std::io;
|
||||
//! use tui::Terminal;
|
||||
//! use tui::backend::TermionBackend;
|
||||
|
@ -42,7 +39,6 @@
|
|||
//! and then create the terminal in a similar way:
|
||||
//!
|
||||
//! ```rust,ignore
|
||||
//! extern crate tui;
|
||||
//!
|
||||
//! use tui::Terminal;
|
||||
//! use tui::backend::RustboxBackend;
|
||||
|
@ -68,8 +64,6 @@
|
|||
//! The following example renders a block of the size of the terminal:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! extern crate tui;
|
||||
//! extern crate termion;
|
||||
//!
|
||||
//! use std::io;
|
||||
//! use termion::raw::IntoRawMode;
|
||||
|
@ -99,8 +93,6 @@
|
|||
//! full customization. And `Layout` is no exception:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! extern crate tui;
|
||||
//! extern crate termion;
|
||||
//!
|
||||
//! use std::io;
|
||||
//! use termion::raw::IntoRawMode;
|
||||
|
@ -142,16 +134,6 @@
|
|||
//! 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.
|
||||
|
||||
#[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 buffer;
|
||||
pub mod layout;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use log::error;
|
||||
use std::io;
|
||||
|
||||
use backend::Backend;
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use widgets::Widget;
|
||||
use crate::backend::Backend;
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::widgets::Widget;
|
||||
|
||||
/// Interface to the terminal backed by Termion
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -2,18 +2,17 @@ use std::cmp::{max, min};
|
|||
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use symbols::bar;
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::symbols::bar;
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
/// Display multiple bars in a single widgets
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, BarChart};
|
||||
/// # use tui::style::{Style, Color, Modifier};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use symbols::line;
|
||||
use widgets::{Borders, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::symbols::line;
|
||||
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
|
||||
/// the widget and/or add a title.
|
||||
|
@ -10,7 +10,6 @@ use widgets::{Borders, Widget};
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders};
|
||||
/// # use tui::style::{Style, Color};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
pub struct Line {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use style::Color;
|
||||
use widgets::canvas::points::PointsIterator;
|
||||
use widgets::canvas::world::{WORLD_HIGH_RESOLUTION, WORLD_LOW_RESOLUTION};
|
||||
use widgets::canvas::Shape;
|
||||
use crate::style::Color;
|
||||
use crate::widgets::canvas::points::PointsIterator;
|
||||
use crate::widgets::canvas::world::{WORLD_HIGH_RESOLUTION, WORLD_LOW_RESOLUTION};
|
||||
use crate::widgets::canvas::Shape;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum MapResolution {
|
||||
|
|
|
@ -7,10 +7,10 @@ pub use self::line::Line;
|
|||
pub use self::map::{Map, MapResolution};
|
||||
pub use self::points::Points;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::{Color, Style};
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Style};
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
pub const DOTS: [[u16; 2]; 4] = [
|
||||
[0x0001, 0x0008],
|
||||
|
@ -132,7 +132,6 @@ impl<'a> Context<'a> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders};
|
||||
/// # use tui::widgets::canvas::{Canvas, Shape, Line, Map, MapResolution};
|
||||
/// # use tui::style::Color;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::slice;
|
||||
|
||||
use super::Shape;
|
||||
use style::Color;
|
||||
use crate::style::Color;
|
||||
|
||||
/// A shape to draw a group of points with the given color
|
||||
pub struct Points<'a> {
|
||||
|
|
|
@ -2,12 +2,12 @@ use std::cmp::max;
|
|||
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use symbols;
|
||||
use widgets::canvas::{Canvas, Points};
|
||||
use widgets::{Block, Borders, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::symbols;
|
||||
use crate::widgets::canvas::{Canvas, Points};
|
||||
use crate::widgets::{Block, Borders, Widget};
|
||||
|
||||
/// An X or Y axis for the chart widget
|
||||
pub struct Axis<'a, L>
|
||||
|
@ -166,7 +166,6 @@ impl Default for ChartLayout {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, Chart, Axis, Dataset, Marker};
|
||||
/// # use tui::style::{Style, Color};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::{Color, Style};
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Style};
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
/// A widget to display a task progress.
|
||||
///
|
||||
/// # Examples:
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Widget, Gauge, Block, Borders};
|
||||
/// # use tui::style::{Style, Color, Modifier};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -3,10 +3,10 @@ use std::iter::Iterator;
|
|||
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::{Corner, Rect};
|
||||
use style::Style;
|
||||
use widgets::{Block, Text, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::{Corner, Rect};
|
||||
use crate::style::Style;
|
||||
use crate::widgets::{Block, Text, Widget};
|
||||
|
||||
pub struct List<'b, L>
|
||||
where
|
||||
|
@ -117,7 +117,6 @@ where
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, SelectableList};
|
||||
/// # use tui::style::{Style, Color, Modifier};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use bitflags::bitflags;
|
||||
use std::borrow::Cow;
|
||||
|
||||
mod barchart;
|
||||
|
@ -22,11 +23,11 @@ pub use self::sparkline::Sparkline;
|
|||
pub use self::table::{Row, Table};
|
||||
pub use self::tabs::Tabs;
|
||||
|
||||
use backend::Backend;
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::{Color, Style};
|
||||
use terminal::Frame;
|
||||
use crate::backend::Backend;
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::{Color, Style};
|
||||
use crate::terminal::Frame;
|
||||
|
||||
/// Bitflags that can be composed to set the visible borders essentially on the block widget.
|
||||
bitflags! {
|
||||
|
|
|
@ -2,11 +2,11 @@ use either::Either;
|
|||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::{Alignment, Rect};
|
||||
use style::Style;
|
||||
use widgets::reflow::{LineComposer, LineTruncator, Styled, WordWrapper};
|
||||
use widgets::{Block, Text, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::{Alignment, Rect};
|
||||
use crate::style::Style;
|
||||
use crate::widgets::reflow::{LineComposer, LineTruncator, Styled, WordWrapper};
|
||||
use crate::widgets::{Block, Text, Widget};
|
||||
|
||||
fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment) -> u16 {
|
||||
match alignment {
|
||||
|
@ -21,7 +21,6 @@ fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment)
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, Paragraph, Text};
|
||||
/// # use tui::style::{Style, Color};
|
||||
/// # use tui::layout::{Alignment};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use style::Style;
|
||||
use crate::style::Style;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
const NBSP: &str = "\u{00a0}";
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
use std::cmp::min;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use symbols::bar;
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::symbols::bar;
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
/// Widget to render a sparkline over one or more lines.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, Sparkline};
|
||||
/// # use tui::style::{Style, Color};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::fmt::Display;
|
||||
use std::iter::Iterator;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
/// Holds data to be displayed in a Table widget
|
||||
pub enum Row<D, I>
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use buffer::Buffer;
|
||||
use layout::Rect;
|
||||
use style::Style;
|
||||
use symbols::line;
|
||||
use widgets::{Block, Widget};
|
||||
use crate::buffer::Buffer;
|
||||
use crate::layout::Rect;
|
||||
use crate::style::Style;
|
||||
use crate::symbols::line;
|
||||
use crate::widgets::{Block, Widget};
|
||||
|
||||
/// A widget to display available tabs in a multiple panels context.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tui;
|
||||
/// # use tui::widgets::{Block, Borders, Tabs};
|
||||
/// # use tui::style::{Style, Color};
|
||||
/// # fn main() {
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
extern crate tui;
|
||||
extern crate unicode_width;
|
||||
|
||||
use tui::backend::TestBackend;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::Rect;
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
extern crate tui;
|
||||
extern crate unicode_width;
|
||||
|
||||
use tui::backend::TestBackend;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::{Constraint, Direction, Layout};
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
extern crate failure;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
use tui::backend::TestBackend;
|
||||
use tui::buffer::Buffer;
|
||||
use tui::layout::Alignment;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate tui;
|
||||
|
||||
use tui::backend::{Backend, TestBackend};
|
||||
use tui::Terminal;
|
||||
|
||||
|
|
Loading…
Reference in a new issue