Update to Rust 2018

Run `cargo fix --edition` and update Cargo.toml
This commit is contained in:
Alexandre Bury 2019-02-28 15:54:12 -08:00
parent 88d2fb1f46
commit e51be07e5d
73 changed files with 313 additions and 312 deletions

View File

@ -10,6 +10,7 @@ name = "cursive"
readme = "Readme.md"
repository = "https://github.com/gyscos/Cursive"
version = "0.10.1-alpha.0"
edition = "2018"
[badges.travis-ci]
repository = "gyscos/Cursive"

View File

@ -13,10 +13,10 @@ use self::bear_lib_terminal::terminal::{
};
use self::bear_lib_terminal::Color as BltColor;
use backend;
use event::{Event, Key, MouseButton, MouseEvent};
use theme::{BaseColor, Color, ColorPair, Effect};
use vec::Vec2;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme::{BaseColor, Color, ColorPair, Effect};
use crate::vec::Vec2;
enum ColorRole {
Foreground,

View File

@ -5,8 +5,8 @@
use std::collections::HashMap;
use event::{Event, Key};
use theme::{BaseColor, Color, ColorPair};
use crate::event::{Event, Key};
use crate::theme::{BaseColor, Color, ColorPair};
#[cfg(feature = "ncurses-backend")]
pub mod n;

View File

@ -10,11 +10,11 @@ use std::io::Write;
use libc;
use backend;
use event::{Event, Key, MouseButton, MouseEvent};
use theme::{Color, ColorPair, Effect};
use utf8;
use vec::Vec2;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme::{Color, ColorPair, Effect};
use crate::utf8;
use crate::vec::Vec2;
use self::super::split_i32;
use self::ncurses::mmask_t;

View File

@ -5,10 +5,10 @@ use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::io::{stdout, Write};
use backend;
use event::{Event, Key, MouseButton, MouseEvent};
use theme::{Color, ColorPair, Effect};
use vec::Vec2;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme::{Color, ColorPair, Effect};
use crate::vec::Vec2;
use self::pancurses::mmask_t;
use super::split_i32;

View File

@ -1,9 +1,9 @@
//! Dummy backend
use backend;
use event::Event;
use theme;
use vec::Vec2;
use crate::backend;
use crate::event::Event;
use crate::theme;
use crate::vec::Vec2;
/// Dummy backend that does nothing and immediately exits.
///

View File

@ -7,9 +7,9 @@
//! using some common libraries. Each of those included backends needs a
//! corresonding feature to be enabled.
use event::Event;
use theme;
use vec::Vec2;
use crate::event::Event;
use crate::theme;
use crate::vec::Vec2;
#[cfg(unix)]
mod resize;

View File

@ -16,10 +16,10 @@ use self::termion::screen::AlternateScreen;
use self::termion::style as tstyle;
use crossbeam_channel::{self, Receiver};
use backend;
use event::{Event, Key, MouseButton, MouseEvent};
use theme;
use vec::Vec2;
use crate::backend;
use crate::event::{Event, Key, MouseButton, MouseEvent};
use crate::theme;
use crate::vec::Vec2;
use std::cell::{Cell, RefCell};
use std::fs::File;

View File

@ -5,14 +5,14 @@ use std::time::Duration;
use crossbeam_channel::{self, Receiver, Sender};
use backend;
use direction;
use event::{Callback, Event, EventResult};
use printer::Printer;
use theme;
use vec::Vec2;
use view::{self, Finder, IntoBoxedView, Position, View};
use views::{self, LayerPosition};
use crate::backend;
use crate::direction;
use crate::event::{Callback, Event, EventResult};
use crate::printer::Printer;
use crate::theme;
use crate::vec::Vec2;
use crate::view::{self, Finder, IntoBoxedView, Position, View};
use crate::views::{self, LayerPosition};
static DEBUG_VIEW_ID: &'static str = "_cursive_debug_view";
@ -60,7 +60,7 @@ pub type CbSink = Sender<Box<CbFunc>>;
/// working and `FnBox` is unstable.
pub trait CbFunc: Send {
/// Calls the function.
fn call_box(self: Box<Self>, &mut Cursive);
fn call_box(self: Box<Self>, _: &mut Cursive);
}
impl<F: FnOnce(&mut Cursive) -> () + Send> CbFunc for F {

View File

@ -26,8 +26,8 @@
//! `Tab` key would usually cycle focus in the "front" direction, while
//! using the arrow keys would use absolute directions instead.
use vec::Vec2;
use XY;
use crate::vec::Vec2;
use crate::XY;
/// Describes a vertical or horizontal orientation for a view.
#[derive(Clone, Copy, Debug, PartialEq)]

View File

@ -17,8 +17,8 @@ use std::any::Any;
use std::cell::RefCell;
use std::ops::Deref;
use std::rc::Rc;
use vec::Vec2;
use Cursive;
use crate::vec::Vec2;
use crate::Cursive;
/// Callback is a function that can be triggered by an event.
/// It has a mutable access to the cursive root.

View File

@ -129,8 +129,8 @@ mod utf8;
pub mod backend;
pub use cursive::{CbFunc, CbSink, Cursive, ScreenId};
pub use printer::Printer;
pub use vec::Vec2;
pub use with::With;
pub use xy::XY;
pub use crate::cursive::{CbFunc, CbSink, Cursive, ScreenId};
pub use crate::printer::Printer;
pub use crate::vec::Vec2;
pub use crate::with::With;
pub use crate::xy::XY;

View File

@ -12,10 +12,10 @@
//!
//! [menubar]: ../struct.Cursive.html#method.menubar
use event::Callback;
use crate::event::Callback;
use std::rc::Rc;
use Cursive;
use With;
use crate::Cursive;
use crate::With;
/// Root of a menu tree.
#[derive(Default, Clone)]

View File

@ -1,15 +1,15 @@
//! Provide higher-level abstraction to draw things on backends.
use backend::Backend;
use direction::Orientation;
use crate::backend::Backend;
use crate::direction::Orientation;
use enumset::EnumSet;
use std::cmp::min;
use theme::{BorderStyle, ColorStyle, Effect, PaletteColor, Style, Theme};
use crate::theme::{BorderStyle, ColorStyle, Effect, PaletteColor, Style, Theme};
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use utils::lines::simple::{prefix, suffix};
use vec::Vec2;
use with::With;
use crate::utils::lines::simple::{prefix, suffix};
use crate::vec::Vec2;
use crate::with::With;
/// Convenient interface to draw on a subset of the screen.
///
@ -86,7 +86,7 @@ impl<'a, 'b> Printer<'a, 'b> {
/// Prints some styled text at the given position.
pub fn print_styled<S>(
&self, start: S, text: ::utils::span::SpannedStr<'_, Style>,
&self, start: S, text: crate::utils::span::SpannedStr<'_, Style>,
) where
S: Into<Vec2>,
{

View File

@ -1,6 +1,6 @@
//! Rectangles on the 2D character grid.
use std::ops::Add;
use vec::Vec2;
use crate::vec::Vec2;
/// A non-empty rectangle on the 2D grid.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

View File

@ -102,7 +102,7 @@ impl Palette {
///
/// This will update either the basic palette or the custom values.
pub fn set_color(&mut self, key: &str, color: Color) {
use theme::PaletteColor::*;
use crate::theme::PaletteColor::*;
match key {
"background" => self.basic[Background] = color,
@ -146,8 +146,8 @@ impl Palette {
impl Default for Palette {
fn default() -> Palette {
use self::PaletteColor::*;
use theme::BaseColor::*;
use theme::Color::*;
use crate::theme::BaseColor::*;
use crate::theme::Color::*;
Palette {
basic: enum_map!{

View File

@ -9,7 +9,7 @@
//! ```
#[doc(no_inline)]
pub use view::{Boxable, Finder, Identifiable, Scrollable, View};
pub use crate::view::{Boxable, Finder, Identifiable, Scrollable, View};
#[doc(no_inline)]
pub use With;
pub use crate::With;

View File

@ -1,6 +1,6 @@
use super::Row;
use utils::lines::spans;
use utils::span::{IndexedSpan, SpannedText};
use crate::utils::lines::spans;
use crate::utils::span::{IndexedSpan, SpannedText};
/// Generates rows of text in constrained width.
///

View File

@ -1,4 +1,4 @@
use With;
use crate::With;
/// Represents a row of text within a `String`.
///

View File

@ -2,7 +2,7 @@ use super::chunk::Chunk;
use super::segment::Segment;
use std::rc::Rc;
use unicode_width::UnicodeWidthStr;
use utils::span::SpannedText;
use crate::utils::span::SpannedText;
use xi_unicode::LineBreakLeafIter;
/// Iterator that returns non-breakable chunks of text.

View File

@ -8,7 +8,7 @@ use std::iter::Peekable;
use std::rc::Rc;
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use utils::span::SpannedText;
use crate::utils::span::SpannedText;
/// Generates rows of text in constrainted width.
///

View File

@ -1,5 +1,5 @@
use super::Segment;
use utils::span::{IndexedCow, Span, SpannedStr};
use crate::utils::span::{IndexedCow, Span, SpannedStr};
/// A list of segments representing a row of text
#[derive(Debug, Clone, PartialEq, Eq)]

View File

@ -1,4 +1,4 @@
use utils::span::{IndexedCow, Span, SpannedStr, SpannedText};
use crate::utils::span::{IndexedCow, Span, SpannedStr, SpannedText};
/// Refers to a part of a span
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

View File

@ -1,7 +1,7 @@
use super::LinesIterator;
use theme::{Effect, Style};
use utils::markup::StyledString;
use utils::span::Span;
use crate::theme::{Effect, Style};
use crate::utils::markup::StyledString;
use crate::utils::span::Span;
fn input() -> StyledString {
let mut text = StyledString::plain("I ");

View File

@ -5,9 +5,9 @@
extern crate pulldown_cmark;
use self::pulldown_cmark::{Event, Tag};
use theme::{Effect, Style};
use utils::markup::{StyledIndexedSpan, StyledString};
use utils::span::IndexedCow;
use crate::theme::{Effect, Style};
use crate::utils::markup::{StyledIndexedSpan, StyledString};
use crate::utils::span::IndexedCow;
/// Parses the given string as markdown text.
pub fn parse<S>(input: S) -> StyledString
@ -132,7 +132,7 @@ pub fn parse_spans<'a>(input: &'a str) -> Vec<StyledIndexedSpan> {
#[cfg(test)]
mod tests {
use super::*;
use utils::span::Span;
use crate::utils::span::Span;
#[test]
fn test_parse() {

View File

@ -5,8 +5,8 @@
#[cfg(feature = "markdown")]
pub mod markdown;
use theme::Style;
use utils::span::{IndexedSpan, Span, SpannedString};
use crate::theme::Style;
use crate::utils::span::{IndexedSpan, Span, SpannedString};
/// A parsed string with markup style.
///

View File

@ -1,5 +1,5 @@
use std::io::{self, Read};
use utils::Counter;
use crate::utils::Counter;
/// Wrapper around a `Read` that reports the progress made.
///

View File

@ -5,8 +5,8 @@ use std::ops::{Add, Div, Mul, Sub};
use num::traits::Zero;
use div;
use XY;
use crate::div;
use crate::XY;
/// Simple 2D size, in cells.
///

View File

@ -1,5 +1,5 @@
use std::any::Any;
use view::View;
use crate::view::View;
/// A view that can be downcasted to its concrete type.
///

View File

@ -1,6 +1,6 @@
use vec::Vec2;
use view::{SizeConstraint, View};
use views::BoxView;
use crate::vec::Vec2;
use crate::view::{SizeConstraint, View};
use crate::views::BoxView;
/// Makes a view wrappable in a [`BoxView`].
///

View File

@ -1,6 +1,6 @@
use std::any::Any;
use view::{View, ViewPath, ViewWrapper};
use views::{IdView, ViewRef};
use crate::view::{View, ViewPath, ViewWrapper};
use crate::views::{IdView, ViewRef};
/// Provides `call_on<V: View>` to views.
///

View File

@ -1,5 +1,5 @@
use view::View;
use views::IdView;
use crate::view::View;
use crate::views::IdView;
/// Makes a view wrappable in an [`IdView`].
///

View File

@ -1,4 +1,4 @@
use view::View;
use crate::view::View;
/// Represents a type that can be made into a `Box<View>`.
pub trait IntoBoxedView {

View File

@ -1,5 +1,5 @@
use std::ops::{Add, Div, Mul, Sub};
use vec::Vec2;
use crate::vec::Vec2;
/// Four values representing each direction.
#[derive(Clone, Copy)]

View File

@ -1,6 +1,6 @@
use std::cmp::min;
use vec::Vec2;
use XY;
use crate::vec::Vec2;
use crate::XY;
/// Location of the view on screen
pub type Position = XY<Offset>;
@ -85,7 +85,7 @@ impl Offset {
mod tests {
use super::Position;
use vec::Vec2;
use crate::vec::Vec2;
#[test]
fn test_center() {

View File

@ -1,8 +1,8 @@
use div::div_up;
use crate::div::div_up;
use std::cmp::{max, min};
use theme::ColorStyle;
use vec::Vec2;
use Printer;
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::Printer;
/// Provide scrolling functionalities to a view.
///

View File

@ -1,5 +1,5 @@
use view::View;
use views::ScrollView;
use crate::view::View;
use crate::views::ScrollView;
/// Makes a view wrappable in a [`ScrollView`].
///

View File

@ -1,5 +1,5 @@
use vec::Vec2;
use XY;
use crate::vec::Vec2;
use crate::XY;
/// Cache around a one-dimensional layout result.
///

View File

@ -1,10 +1,10 @@
use direction::Direction;
use event::{AnyCb, Event, EventResult};
use rect::Rect;
use crate::direction::Direction;
use crate::event::{AnyCb, Event, EventResult};
use crate::rect::Rect;
use std::any::Any;
use vec::Vec2;
use view::{AnyView, Selector};
use Printer;
use crate::vec::Vec2;
use crate::view::{AnyView, Selector};
use crate::Printer;
/// Main trait defining a view behaviour.
///
@ -23,7 +23,7 @@ pub trait View: Any + AnyView {
///
/// At this point, the given size is final and cannot be negociated.
/// It is guaranteed to be the size available for the call to `draw()`.
fn layout(&mut self, Vec2) {}
fn layout(&mut self, _: Vec2) {}
/// Should return `true` if the view content changed since the last call
/// to `layout()`.
@ -67,7 +67,7 @@ pub trait View: Any + AnyView {
/// to be run.
///
/// The default implementation just ignores any event.
fn on_event(&mut self, Event) -> EventResult {
fn on_event(&mut self, _: Event) -> EventResult {
EventResult::Ignored
}
@ -92,7 +92,7 @@ pub trait View: Any + AnyView {
/// Returns `Ok(())` if the view was found and selected.
///
/// Default implementation simply returns `Err(())`.
fn focus_view(&mut self, &Selector) -> Result<(), ()> {
fn focus_view(&mut self, _: &Selector) -> Result<(), ()> {
Err(())
}

View File

@ -1,10 +1,10 @@
use direction::Direction;
use event::{AnyCb, Event, EventResult};
use rect::Rect;
use crate::direction::Direction;
use crate::event::{AnyCb, Event, EventResult};
use crate::rect::Rect;
use std::any::Any;
use vec::Vec2;
use view::{Selector, View};
use Printer;
use crate::vec::Vec2;
use crate::view::{Selector, View};
use crate::Printer;
/// Generic wrapper around a view.
///

View File

@ -1,7 +1,7 @@
use vec::Vec2;
use view::{SizeConstraint, View, ViewWrapper};
use With;
use XY;
use crate::vec::Vec2;
use crate::view::{SizeConstraint, View, ViewWrapper};
use crate::With;
use crate::XY;
/// Wrapper around another view, with a controlled size.
///
@ -250,9 +250,9 @@ impl<T: View> ViewWrapper for BoxView<T> {
#[cfg(test)]
mod tests {
use vec::Vec2;
use view::{Boxable, View};
use views::DummyView;
use crate::vec::Vec2;
use crate::view::{Boxable, View};
use crate::views::DummyView;
// No need to test `draw()` method as it's directly forwarded.
@ -316,7 +316,7 @@ mod tests {
#[test]
fn test_get_inner() {
use views::TextView;
use crate::views::TextView;
let parent = TextView::new("abc").full_screen();
let child = parent.get_inner();
@ -324,7 +324,7 @@ mod tests {
}
#[test]
fn test_get_inner_mut() {
use views::TextView;
use crate::views::TextView;
let mut parent = TextView::new("").full_screen();
let new_value = "new";

View File

@ -1,12 +1,12 @@
use align::HAlign;
use direction::Direction;
use event::*;
use rect::Rect;
use theme::ColorStyle;
use crate::align::HAlign;
use crate::direction::Direction;
use crate::event::*;
use crate::rect::Rect;
use crate::theme::ColorStyle;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::View;
use {Cursive, Printer, With};
use crate::vec::Vec2;
use crate::view::View;
use crate::{Cursive, Printer, With};
/// Simple text label with a callback when <Enter> is pressed.
///

View File

@ -1,10 +1,10 @@
use direction::Direction;
use event::{AnyCb, Event, EventResult};
use rect::Rect;
use vec::Vec2;
use view::{Selector, View};
use Printer;
use With;
use crate::direction::Direction;
use crate::event::{AnyCb, Event, EventResult};
use crate::rect::Rect;
use crate::vec::Vec2;
use crate::view::{Selector, View};
use crate::Printer;
use crate::With;
/// A blank view that forwards calls to closures.
///

View File

@ -1,12 +1,12 @@
use direction::Direction;
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
use crate::direction::Direction;
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
use std::rc::Rc;
use theme::ColorStyle;
use vec::Vec2;
use view::View;
use Cursive;
use Printer;
use With;
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::View;
use crate::Cursive;
use crate::Printer;
use crate::With;
/// Checkable box.
pub struct Checkbox {

View File

@ -1,6 +1,6 @@
use direction::Direction;
use event::{Event, EventResult, Key};
use view::{View, ViewWrapper};
use crate::direction::Direction;
use crate::event::{Event, EventResult, Key};
use crate::view::{View, ViewWrapper};
/// Adds circular focus to a wrapped view.
///

View File

@ -1,8 +1,8 @@
use logger;
use theme;
use vec::Vec2;
use view::View;
use Printer;
use crate::logger;
use crate::theme;
use crate::vec::Vec2;
use crate::view::View;
use crate::Printer;
use unicode_width::UnicodeWidthStr;

View File

@ -1,17 +1,17 @@
use align::*;
use direction::{Absolute, Direction, Relative};
use event::{AnyCb, Event, EventResult, Key};
use rect::Rect;
use crate::align::*;
use crate::direction::{Absolute, Direction, Relative};
use crate::event::{AnyCb, Event, EventResult, Key};
use crate::rect::Rect;
use std::cell::Cell;
use std::cmp::max;
use theme::ColorStyle;
use crate::theme::ColorStyle;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::{Margins, Selector, View};
use views::{Button, DummyView, SizedView, TextView, ViewBox};
use Cursive;
use Printer;
use With;
use crate::vec::Vec2;
use crate::view::{Margins, Selector, View};
use crate::views::{Button, DummyView, SizedView, TextView, ViewBox};
use crate::Cursive;
use crate::Printer;
use crate::With;
/// Identifies currently focused element in [`Dialog`].
///

View File

@ -1,5 +1,5 @@
use view::View;
use Printer;
use crate::view::View;
use crate::Printer;
/// Dummy view.
///

View File

@ -1,15 +1,15 @@
use direction::Direction;
use event::{Callback, Event, EventResult, Key, MouseEvent};
use rect::Rect;
use crate::direction::Direction;
use crate::event::{Callback, Event, EventResult, Key, MouseEvent};
use crate::rect::Rect;
use std::cell::RefCell;
use std::rc::Rc;
use theme::{ColorStyle, Effect};
use crate::theme::{ColorStyle, Effect};
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
use utils::lines::simple::{simple_prefix, simple_suffix};
use vec::Vec2;
use view::View;
use {Cursive, Printer, With};
use crate::utils::lines::simple::{simple_prefix, simple_suffix};
use crate::vec::Vec2;
use crate::view::View;
use crate::{Cursive, Printer, With};
/// Closure type for callbacks when the content is modified.
///

View File

@ -1,6 +1,6 @@
use event::{Event, EventResult};
use view::{View, ViewWrapper};
use {Printer, With};
use crate::event::{Event, EventResult};
use crate::view::{View, ViewWrapper};
use crate::{Printer, With};
/// Wrapper around another view that can be enabled/disabled at will.
///

View File

@ -1,6 +1,6 @@
use vec::Vec2;
use view::{Selector, View, ViewWrapper};
use With;
use crate::vec::Vec2;
use crate::view::{Selector, View, ViewWrapper};
use crate::With;
use std::any::Any;

View File

@ -3,7 +3,7 @@ use std::any::Any;
use std::cell::{RefCell, RefMut};
use std::ops::DerefMut;
use std::rc::Rc;
use view::{Selector, View, ViewWrapper};
use crate::view::{Selector, View, ViewWrapper};
/// Wrapper around a view to provide interior mutability.
pub struct IdView<V: View> {

View File

@ -1,5 +1,5 @@
use view::{View, ViewWrapper};
use Printer;
use crate::view::{View, ViewWrapper};
use crate::Printer;
/// Wrapper view that fills the background.
///

View File

@ -1,13 +1,13 @@
use direction;
use event::{AnyCb, Event, EventResult, Key};
use rect::Rect;
use crate::direction;
use crate::event::{AnyCb, Event, EventResult, Key};
use crate::rect::Rect;
use std::cmp::min;
use std::ops::Deref;
use vec::Vec2;
use view::{Selector, SizeCache, View};
use Printer;
use With;
use XY;
use crate::vec::Vec2;
use crate::view::{Selector, SizeCache, View};
use crate::Printer;
use crate::With;
use crate::XY;
/// Arranges its children linearly according to its orientation.
pub struct LinearLayout {

View File

@ -1,13 +1,13 @@
use direction;
use event::{AnyCb, Callback, Event, EventResult, Key};
use rect::Rect;
use crate::direction;
use crate::event::{AnyCb, Callback, Event, EventResult, Key};
use crate::rect::Rect;
use std::rc::Rc;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::{Selector, View};
use Cursive;
use Printer;
use With;
use crate::vec::Vec2;
use crate::view::{Selector, View};
use crate::Cursive;
use crate::Printer;
use crate::With;
/// Represents a child from a [`ListView`].
///

View File

@ -1,16 +1,16 @@
use align::Align;
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use menu::{MenuItem, MenuTree};
use rect::Rect;
use crate::align::Align;
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use crate::menu::{MenuItem, MenuTree};
use crate::rect::Rect;
use std::cmp::min;
use std::rc::Rc;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::{Position, ScrollBase, View};
use views::OnEventView;
use Cursive;
use Printer;
use With;
use crate::vec::Vec2;
use crate::view::{Position, ScrollBase, View};
use crate::views::OnEventView;
use crate::Cursive;
use crate::Printer;
use crate::With;
/// Popup that shows a list of items.
pub struct MenuPopup {

View File

@ -1,15 +1,15 @@
use direction;
use event::*;
use menu::{MenuItem, MenuTree};
use rect::Rect;
use crate::direction;
use crate::event::*;
use crate::menu::{MenuItem, MenuTree};
use crate::rect::Rect;
use std::rc::Rc;
use theme::ColorStyle;
use crate::theme::ColorStyle;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::{Position, View};
use views::{MenuPopup, OnEventView};
use Cursive;
use Printer;
use crate::vec::Vec2;
use crate::view::{Position, View};
use crate::views::{MenuPopup, OnEventView};
use crate::Cursive;
use crate::Printer;
/// Current state of the menubar
#[derive(PartialEq, Debug)]

View File

@ -1,8 +1,8 @@
use event::{Callback, Event, EventResult, EventTrigger};
use crate::event::{Callback, Event, EventResult, EventTrigger};
use std::rc::Rc;
use view::{View, ViewWrapper};
use Cursive;
use With;
use crate::view::{View, ViewWrapper};
use crate::Cursive;
use crate::With;
/// A wrapper view that can react to events.
///

View File

@ -1,7 +1,7 @@
use event::{Event, EventResult};
use vec::Vec2;
use view::{Margins, View, ViewWrapper};
use Printer;
use crate::event::{Event, EventResult};
use crate::vec::Vec2;
use crate::view::{Margins, View, ViewWrapper};
use crate::Printer;
/// Adds padding to another view.
///

View File

@ -1,12 +1,12 @@
use align::*;
use event::{Event, EventResult};
use rect::Rect;
use theme::ColorStyle;
use crate::align::*;
use crate::event::{Event, EventResult};
use crate::rect::Rect;
use crate::theme::ColorStyle;
use unicode_width::UnicodeWidthStr;
use vec::Vec2;
use view::{View, ViewWrapper};
use Printer;
use With;
use crate::vec::Vec2;
use crate::view::{View, ViewWrapper};
use crate::Printer;
use crate::With;
/// Draws a border around a wrapped view.
#[derive(Debug)]

View File

@ -1,10 +1,10 @@
use align::HAlign;
use crate::align::HAlign;
use std::cmp;
use std::thread;
use theme::{ColorStyle, ColorType, Effect};
use utils::Counter;
use view::View;
use {Printer, With};
use crate::theme::{ColorStyle, ColorType, Effect};
use crate::utils::Counter;
use crate::view::View;
use crate::{Printer, With};
// pub type CbPromise = Option<Box<Fn(&mut Cursive) + Send>>;

View File

@ -1,12 +1,12 @@
use direction::Direction;
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
use crate::direction::Direction;
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
use std::cell::RefCell;
use std::rc::Rc;
use theme::ColorStyle;
use vec::Vec2;
use view::View;
use Cursive;
use {Printer, With};
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::View;
use crate::Cursive;
use crate::{Printer, With};
struct SharedState<T> {
selection: usize,

View File

@ -1,11 +1,11 @@
use std::cmp::min;
use direction::{Direction, Orientation};
use event::{AnyCb, Event, EventResult, Key, MouseButton, MouseEvent};
use rect::Rect;
use theme::ColorStyle;
use view::{ScrollStrategy, Selector, SizeCache, View};
use {Printer, Vec2, With, XY};
use crate::direction::{Direction, Orientation};
use crate::event::{AnyCb, Event, EventResult, Key, MouseButton, MouseEvent};
use crate::rect::Rect;
use crate::theme::ColorStyle;
use crate::view::{ScrollStrategy, Selector, SizeCache, View};
use crate::{Printer, Vec2, With, XY};
/// Wraps a view in a scrollable area.
pub struct ScrollView<V> {

View File

@ -1,20 +1,20 @@
use align::{Align, HAlign, VAlign};
use direction::Direction;
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use menu::MenuTree;
use rect::Rect;
use crate::align::{Align, HAlign, VAlign};
use crate::direction::Direction;
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use crate::menu::MenuTree;
use crate::rect::Rect;
use std::borrow::Borrow;
use std::cell::Cell;
use std::cmp::min;
use std::rc::Rc;
use theme::ColorStyle;
use utils::markup::StyledString;
use vec::Vec2;
use view::{Position, View};
use views::MenuPopup;
use Cursive;
use Printer;
use With;
use crate::theme::ColorStyle;
use crate::utils::markup::StyledString;
use crate::vec::Vec2;
use crate::view::{Position, View};
use crate::views::MenuPopup;
use crate::Cursive;
use crate::Printer;
use crate::With;
/// View to select an item among a list.
///

View File

@ -1,8 +1,8 @@
use event::{Event, EventResult};
use theme::ColorStyle;
use vec::Vec2;
use view::{View, ViewWrapper};
use Printer;
use crate::event::{Event, EventResult};
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::{View, ViewWrapper};
use crate::Printer;
/// Wrapper view that adds a shadow.
///

View File

@ -1,6 +1,6 @@
use vec::Vec2;
use view::View;
use view::ViewWrapper;
use crate::vec::Vec2;
use crate::view::View;
use crate::view::ViewWrapper;
/// Wrapper around a view that remembers its size.
pub struct SizedView<T> {

View File

@ -1,11 +1,11 @@
use direction::{Direction, Orientation};
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use crate::direction::{Direction, Orientation};
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use std::rc::Rc;
use theme::ColorStyle;
use vec::Vec2;
use view::View;
use With;
use {Cursive, Printer};
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::View;
use crate::With;
use crate::{Cursive, Printer};
/// A horizontal or vertical slider.
pub struct SliderView {

View File

@ -1,13 +1,13 @@
use direction::Direction;
use event::{AnyCb, Event, EventResult};
use crate::direction::Direction;
use crate::event::{AnyCb, Event, EventResult};
use std::cell;
use std::ops::Deref;
use theme::ColorStyle;
use vec::Vec2;
use view::{IntoBoxedView, Offset, Position, Selector, View, ViewWrapper};
use views::{CircularFocus, Layer, ShadowView, ViewBox};
use Printer;
use With;
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::{IntoBoxedView, Offset, Position, Selector, View, ViewWrapper};
use crate::views::{CircularFocus, Layer, ShadowView, ViewBox};
use crate::Printer;
use crate::With;
/// Simple stack of views.
/// Only the top-most view is active and can receive input.
@ -673,7 +673,7 @@ impl View for StackView {
#[cfg(test)]
mod tests {
use super::*;
use views::TextView;
use crate::views::TextView;
#[test]
fn pop_add() {

View File

@ -1,14 +1,14 @@
use direction::Direction;
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
use rect::Rect;
use crate::direction::Direction;
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
use crate::rect::Rect;
use std::cmp::min;
use theme::{ColorStyle, Effect};
use crate::theme::{ColorStyle, Effect};
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use utils::lines::simple::{prefix, simple_prefix, LinesIterator, Row};
use vec::Vec2;
use view::{ScrollBase, SizeCache, View};
use {Printer, With, XY};
use crate::utils::lines::simple::{prefix, simple_prefix, LinesIterator, Row};
use crate::vec::Vec2;
use crate::view::{ScrollBase, SizeCache, View};
use crate::{Printer, With, XY};
/// Multi-lines text editor.
///

View File

@ -5,12 +5,12 @@ use std::sync::{Mutex, MutexGuard};
use owning_ref::{ArcRef, OwningHandle};
use unicode_width::UnicodeWidthStr;
use align::*;
use theme::Effect;
use utils::lines::spans::{LinesIterator, Row};
use utils::markup::StyledString;
use view::{SizeCache, View};
use {Printer, Vec2, With, XY};
use crate::align::*;
use crate::theme::Effect;
use crate::utils::lines::spans::{LinesIterator, Row};
use crate::utils::markup::StyledString;
use crate::view::{SizeCache, View};
use crate::{Printer, Vec2, With, XY};
/// Provides access to the content of a [`TextView`].
///

View File

@ -1,8 +1,8 @@
use std::cell::Cell;
use vec::Vec2;
use view::{View, ViewWrapper};
use views::IdView;
use Printer;
use crate::vec::Vec2;
use crate::view::{View, ViewWrapper};
use crate::views::IdView;
use crate::Printer;
/// Wrapper around a view that remembers its position.
pub struct TrackedView<T: View> {

View File

@ -1,5 +1,5 @@
use std::ops::{Deref, DerefMut};
use view::{IntoBoxedView, View, ViewWrapper};
use crate::view::{IntoBoxedView, View, ViewWrapper};
/// A boxed `View`.
///

View File

@ -1,4 +1,4 @@
use direction::Orientation;
use crate::direction::Orientation;
use std::iter;
/// A generic structure with a value for each axis.