From e2f5806deb24fcf3379b23a86d8e4185de50ec48 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Tue, 9 Feb 2021 09:54:15 -0800 Subject: [PATCH] Add public re-exports of crates used in public api --- cursive-core/Cargo.toml | 2 -- cursive-core/src/lib.rs | 15 ++++++++++++--- cursive/src/backends/blt.rs | 2 ++ cursive/src/backends/crossterm.rs | 2 ++ cursive/src/backends/curses/mod.rs | 3 --- cursive/src/backends/curses/n.rs | 3 +++ cursive/src/backends/curses/pan.rs | 4 ++++ cursive/src/backends/puppet/observed.rs | 2 +- cursive/src/backends/puppet/static_values.rs | 2 +- cursive/src/backends/termion.rs | 2 ++ cursive/src/lib.rs | 2 -- examples/src/bin/stopwatch.rs | 2 +- 12 files changed, 28 insertions(+), 13 deletions(-) diff --git a/cursive-core/Cargo.toml b/cursive-core/Cargo.toml index 6c3fd53..be94d61 100644 --- a/cursive-core/Cargo.toml +++ b/cursive-core/Cargo.toml @@ -25,11 +25,9 @@ enum-map = "0.6" enumset = "1.0.4" log = "0.4" owning_ref = "0.4" -syn = "1.0" unicode-segmentation = "1" unicode-width = "0.1" xi-unicode = "0.3" -libc = "0.2" crossbeam-channel = "0.5" lazy_static = "1" chrono = "0.4" diff --git a/cursive-core/src/lib.rs b/cursive-core/src/lib.rs index ee1290c..dcb2251 100644 --- a/cursive-core/src/lib.rs +++ b/cursive-core/src/lib.rs @@ -8,9 +8,6 @@ //! //! [`cursive`]: https://docs.rs/cursive #![deny(missing_docs)] - -pub use enumset; - macro_rules! new_default( ($c:ident<$t:ident>) => { impl<$t> Default for $c<$t> { @@ -36,6 +33,18 @@ macro_rules! new_default( }; ); +/// Re-export crates used in the public API +pub mod reexports { + pub use ahash; + pub use chrono; + pub use crossbeam_channel; + pub use enumset; + pub use log; + + #[cfg(feature = "toml")] + pub use toml; +} + #[macro_use] pub mod utils; #[macro_use] diff --git a/cursive/src/backends/blt.rs b/cursive/src/backends/blt.rs index 118ab34..acc6735 100644 --- a/cursive/src/backends/blt.rs +++ b/cursive/src/backends/blt.rs @@ -3,6 +3,8 @@ //! Requires the `blt-backend` feature. #![cfg(feature = "bear-lib-terminal")] +pub use bear_lib_terminal; + use bear_lib_terminal::geometry::Size; use bear_lib_terminal::terminal::{self, state, Event as BltEvent, KeyCode}; use bear_lib_terminal::Color as BltColor; diff --git a/cursive/src/backends/crossterm.rs b/cursive/src/backends/crossterm.rs index 63957cb..1d38f70 100644 --- a/cursive/src/backends/crossterm.rs +++ b/cursive/src/backends/crossterm.rs @@ -11,6 +11,8 @@ use std::{ time::Duration, }; +pub use crossterm; + use crossterm::{ cursor::{Hide, MoveTo, Show}, event::{ diff --git a/cursive/src/backends/curses/mod.rs b/cursive/src/backends/curses/mod.rs index a43245e..c6c8bf3 100644 --- a/cursive/src/backends/curses/mod.rs +++ b/cursive/src/backends/curses/mod.rs @@ -7,10 +7,7 @@ use crate::event::{Event, Key}; use crate::theme::{BaseColor, Color, ColorPair}; use maplit::hashmap; -#[cfg(feature = "ncurses-backend")] pub mod n; - -#[cfg(feature = "pancurses-backend")] pub mod pan; // Use AHash instead of the slower SipHash diff --git a/cursive/src/backends/curses/n.rs b/cursive/src/backends/curses/n.rs index f0c6260..8c089bc 100644 --- a/cursive/src/backends/curses/n.rs +++ b/cursive/src/backends/curses/n.rs @@ -1,4 +1,7 @@ //! Ncurses-specific backend. +#![cfg(feature = "ncurses-backend")] +pub use ncurses; + use log::{debug, warn}; use ncurses::mmask_t; diff --git a/cursive/src/backends/curses/pan.rs b/cursive/src/backends/curses/pan.rs index 3e693fd..2d33521 100644 --- a/cursive/src/backends/curses/pan.rs +++ b/cursive/src/backends/curses/pan.rs @@ -1,4 +1,8 @@ //! Pancuses-specific backend. +#![cfg(feature = "pancurses-backend")] + +pub use pancurses; + use log::{debug, warn}; use std::cell::{Cell, RefCell}; diff --git a/cursive/src/backends/puppet/observed.rs b/cursive/src/backends/puppet/observed.rs index 2ab6dec..9dac1bf 100644 --- a/cursive/src/backends/puppet/observed.rs +++ b/cursive/src/backends/puppet/observed.rs @@ -1,5 +1,5 @@ //! Structs representing output of puppet backend -use crate::enumset::EnumSet; +use crate::reexports::enumset::EnumSet; use crate::theme::ColorPair; use crate::theme::Effect; use crate::Vec2; diff --git a/cursive/src/backends/puppet/static_values.rs b/cursive/src/backends/puppet/static_values.rs index d814047..608f352 100644 --- a/cursive/src/backends/puppet/static_values.rs +++ b/cursive/src/backends/puppet/static_values.rs @@ -1,7 +1,7 @@ /// Some default values to Puppet backend. use lazy_static::lazy_static; -use crate::enumset::EnumSet; +use crate::reexports::enumset::EnumSet; use crate::theme::ColorPair; use crate::theme::{Color, Effect}; use crate::Vec2; diff --git a/cursive/src/backends/termion.rs b/cursive/src/backends/termion.rs index b86220f..442d6fa 100644 --- a/cursive/src/backends/termion.rs +++ b/cursive/src/backends/termion.rs @@ -3,6 +3,8 @@ //! Requires the `termion-backend` feature. #![cfg(feature = "termion")] +pub use termion; + use crossbeam_channel::{self, select, Receiver}; use termion::color as tcolor; use termion::event::Event as TEvent; diff --git a/cursive/src/lib.rs b/cursive/src/lib.rs index a0e64f6..8d12d3a 100644 --- a/cursive/src/lib.rs +++ b/cursive/src/lib.rs @@ -64,8 +64,6 @@ //! [`cursive::theme`]: ./theme/index.html #![deny(missing_docs)] -pub use cursive_core::enumset; - pub use cursive_core::*; mod utf8; diff --git a/examples/src/bin/stopwatch.rs b/examples/src/bin/stopwatch.rs index 46159e6..8457481 100644 --- a/examples/src/bin/stopwatch.rs +++ b/examples/src/bin/stopwatch.rs @@ -1,5 +1,5 @@ //! A simple stopwatch implementation. -//! Also check out `clock-cli` (https://github.com/TianyiShi2001/cl!ock-cli-rs), +//! Also check out [`clock-cli`](https://github.com/TianyiShi2001/cl!ock-cli-rs), //! which aims to implement a fully-fledged clock with stopwatch, countdown //! timer, and possibly more functionalities.