Replace wasmer_enumset with enumset 1.0.3

This commit is contained in:
Alexandre Bury 2021-02-03 15:17:43 -08:00
parent 96ac21cbaa
commit aedfc9e0c1
9 changed files with 13 additions and 20 deletions

View File

@ -22,7 +22,7 @@ repository = "gyscos/cursive"
[dependencies] [dependencies]
enum-map = "0.6" enum-map = "0.6"
wasmer_enumset = "1" enumset = "1.0.3"
log = "0.4" log = "0.4"
owning_ref = "0.4" owning_ref = "0.4"
syn = "1.0" syn = "1.0"
@ -33,7 +33,7 @@ libc = "0.2"
crossbeam-channel = "0.5" crossbeam-channel = "0.5"
lazy_static = "1" lazy_static = "1"
chrono = "0.4" chrono = "0.4"
ahash = "0.6" ahash = "0.7"
[dependencies.toml] [dependencies.toml]
optional = true optional = true

View File

@ -9,7 +9,7 @@
//! [`cursive`]: https://docs.rs/cursive //! [`cursive`]: https://docs.rs/cursive
#![deny(missing_docs)] #![deny(missing_docs)]
extern crate wasmer_enumset as enumset; pub use enumset;
macro_rules! new_default( macro_rules! new_default(
($c:ident<$t:ident>) => { ($c:ident<$t:ident>) => {

View File

@ -1,4 +1,4 @@
use enumset::EnumSetType; use enumset::{EnumSet, EnumSetType};
/// Text effect /// Text effect
#[allow(clippy::derive_hash_xor_eq)] // We do derive it through EnumSetType #[allow(clippy::derive_hash_xor_eq)] // We do derive it through EnumSetType

View File

@ -1,7 +1,7 @@
use std::iter::FromIterator; use std::iter::FromIterator;
use super::{Color, ColorStyle, ColorType, Effect, PaletteColor}; use super::{Color, ColorStyle, ColorType, Effect, PaletteColor};
use enumset::{enum_set, EnumSet}; use enumset::EnumSet;
/// Combine a color and an effect. /// Combine a color and an effect.
/// ///
@ -53,7 +53,7 @@ impl Style {
impl From<Effect> for Style { impl From<Effect> for Style {
fn from(effect: Effect) -> Self { fn from(effect: Effect) -> Self {
Style { Style {
effects: enum_set!(effect), effects: EnumSet::only(effect),
color: ColorStyle::inherit_parent(), color: ColorStyle::inherit_parent(),
} }
} }

View File

@ -39,7 +39,7 @@ struct Child {
last_size: Vec2, last_size: Vec2,
weight: usize, _weight: usize,
} }
impl Child { impl Child {
@ -150,14 +150,14 @@ impl LinearLayout {
/// ///
/// Panics if `i >= self.len()`. /// Panics if `i >= self.len()`.
pub fn set_weight(&mut self, i: usize, weight: usize) { pub fn set_weight(&mut self, i: usize, weight: usize) {
self.children[i].weight = weight; self.children[i]._weight = weight;
} }
/// Modifies the weight of the last child added. /// Modifies the weight of the last child added.
/// ///
/// It is an error to call this before adding a child (and it will panic). /// It is an error to call this before adding a child (and it will panic).
pub fn weight(mut self, weight: usize) -> Self { pub fn weight(mut self, weight: usize) -> Self {
self.children.last_mut().unwrap().weight = weight; self.children.last_mut().unwrap()._weight = weight;
self self
} }
@ -175,7 +175,7 @@ impl LinearLayout {
view: view.into_boxed_view(), view: view.into_boxed_view(),
required_size: Vec2::zero(), required_size: Vec2::zero(),
last_size: Vec2::zero(), last_size: Vec2::zero(),
weight: 0, _weight: 0,
}); });
self.invalidate(); self.invalidate();
} }
@ -196,7 +196,7 @@ impl LinearLayout {
view: view.into_boxed_view(), view: view.into_boxed_view(),
required_size: Vec2::zero(), required_size: Vec2::zero(),
last_size: Vec2::zero(), last_size: Vec2::zero(),
weight: 0, _weight: 0,
}, },
); );
self.invalidate(); self.invalidate();

View File

@ -40,7 +40,6 @@ pub struct ListView {
focus: usize, focus: usize,
// This callback is called when the selection is changed. // This callback is called when the selection is changed.
on_select: Option<Rc<dyn Fn(&mut Cursive, &String)>>, on_select: Option<Rc<dyn Fn(&mut Cursive, &String)>>,
last_size: Vec2,
} }
new_default!(ListView); new_default!(ListView);
@ -53,7 +52,6 @@ impl ListView {
children_heights: Vec::new(), children_heights: Vec::new(),
focus: 0, focus: 0,
on_select: None, on_select: None,
last_size: Vec2::zero(),
} }
} }
@ -332,8 +330,6 @@ impl View for ListView {
} }
fn layout(&mut self, size: Vec2) { fn layout(&mut self, size: Vec2) {
self.last_size = size;
// We'll show 2 columns: the labels, and the views. // We'll show 2 columns: the labels, and the views.
let label_width = self let label_width = self
.children .children

View File

@ -201,7 +201,6 @@ pub struct TextView {
wrap: bool, wrap: bool,
// ScrollBase make many scrolling-related things easier // ScrollBase make many scrolling-related things easier
last_size: Vec2,
width: Option<usize>, width: Option<usize>,
} }
@ -237,7 +236,6 @@ impl TextView {
rows: Vec::new(), rows: Vec::new(),
wrap: true, wrap: true,
align: Align::top_left(), align: Align::top_left(),
last_size: Vec2::zero(),
width: None, width: None,
} }
} }
@ -424,7 +422,6 @@ impl View for TextView {
fn layout(&mut self, size: Vec2) { fn layout(&mut self, size: Vec2) {
// Compute the text rows. // Compute the text rows.
self.last_size = size;
self.compute_rows(size); self.compute_rows(size);
// The entire "virtual" size (includes all rows) // The entire "virtual" size (includes all rows)

View File

@ -18,7 +18,7 @@ features = ["unstable_scroll", "markdown", "toml"]
cursive_core = { path = "../cursive-core", version= "0.2.2"} cursive_core = { path = "../cursive-core", version= "0.2.2"}
crossbeam-channel = "0.5" crossbeam-channel = "0.5"
cfg-if = "1" cfg-if = "1"
wasmer_enumset = "1" enumset = "1.0.3"
unicode-segmentation = "1" unicode-segmentation = "1"
unicode-width = "0.1" unicode-width = "0.1"
lazy_static = "1" lazy_static = "1"

View File

@ -64,7 +64,7 @@
//! [`cursive::theme`]: ./theme/index.html //! [`cursive::theme`]: ./theme/index.html
#![deny(missing_docs)] #![deny(missing_docs)]
extern crate wasmer_enumset as enumset; pub use enumset;
pub use cursive_core::*; pub use cursive_core::*;