diff --git a/src/backend/crossterm.rs b/src/backend/crossterm.rs index 297a964f..aef71c9e 100644 --- a/src/backend/crossterm.rs +++ b/src/backend/crossterm.rs @@ -42,7 +42,7 @@ use crate::{ /// # Ok(()) /// # } /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct CrosstermBackend { buffer: W, } @@ -209,7 +209,7 @@ impl From for CColor { /// The `ModifierDiff` struct is used to calculate the difference between two `Modifier` /// values. This is useful when updating the terminal display, as it allows for more /// efficient updates by only sending the necessary changes. -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] struct ModifierDiff { pub from: Modifier, pub to: Modifier, diff --git a/src/backend/mod.rs b/src/backend/mod.rs index a9e1d119..97027914 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -49,7 +49,7 @@ pub use self::test::TestBackend; /// Enum representing the different types of clearing operations that can be performed /// on the terminal screen. -#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum ClearType { All, AfterCursor, diff --git a/src/backend/termion.rs b/src/backend/termion.rs index b662fa9e..7ef28bb7 100644 --- a/src/backend/termion.rs +++ b/src/backend/termion.rs @@ -31,7 +31,7 @@ use crate::{ /// # Ok(()) /// # } /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct TermionBackend where W: Write, @@ -164,16 +164,16 @@ where self.stdout.flush() } } -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] struct Fg(Color); -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] struct Bg(Color); /// The `ModifierDiff` struct is used to calculate the difference between two `Modifier` /// values. This is useful when updating the terminal display, as it allows for more /// efficient updates by only sending the necessary changes. -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] struct ModifierDiff { from: Modifier, to: Modifier, diff --git a/src/backend/test.rs b/src/backend/test.rs index b261d8cf..bc88f392 100644 --- a/src/backend/test.rs +++ b/src/backend/test.rs @@ -28,7 +28,7 @@ use crate::{ /// # Ok(()) /// # } /// ``` -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct TestBackend { width: u16, buffer: Buffer, diff --git a/src/buffer.rs b/src/buffer.rs index 3b81b012..640d30c0 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -14,7 +14,7 @@ use crate::{ }; /// A buffer cell -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Cell { pub symbol: String, pub fg: Color, @@ -135,7 +135,7 @@ impl Default for Cell { /// buf.get_mut(5, 0).set_char('x'); /// assert_eq!(buf.get(5, 0).symbol, "x"); /// ``` -#[derive(Default, Clone, Eq, PartialEq)] +#[derive(Default, Clone, Eq, PartialEq, Hash)] pub struct Buffer { /// The area represented by this buffer pub area: Rect, diff --git a/src/layout.rs b/src/layout.rs index 26242e0f..8eaa8c5c 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -420,7 +420,7 @@ fn split(area: Rect, layout: &Layout) -> Rc<[Rect]> { } /// A container used by the solver inside split -#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] struct Element { x: Variable, y: Variable, diff --git a/src/style.rs b/src/style.rs index 1d1c79a3..c76278c3 100644 --- a/src/style.rs +++ b/src/style.rs @@ -89,7 +89,7 @@ pub use stylize::{Styled, Stylize}; /// assert_eq!("white".parse(), Ok(Color::White)); /// assert_eq!("bright white".parse(), Ok(Color::White)); /// ``` -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Color { /// Resets the foreground or background color @@ -151,7 +151,7 @@ bitflags! { /// let m = Modifier::BOLD | Modifier::ITALIC; /// ``` #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - #[derive(Default, Clone, Copy, Eq, PartialEq)] + #[derive(Default, Clone, Copy, Eq, PartialEq, Hash)] pub struct Modifier: u16 { const BOLD = 0b0000_0000_0001; const DIM = 0b0000_0000_0010; @@ -248,7 +248,7 @@ impl fmt::Debug for Modifier { /// buffer.get(0, 0).style(), /// ); /// ``` -#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Style { pub fg: Option, @@ -423,7 +423,7 @@ impl Style { } /// Error type indicating a failure to parse a color string. -#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub struct ParseColorError; impl std::fmt::Display for ParseColorError { diff --git a/src/symbols.rs b/src/symbols.rs index 16c3c958..0f9728ef 100644 --- a/src/symbols.rs +++ b/src/symbols.rs @@ -8,7 +8,7 @@ pub mod block { pub const ONE_QUARTER: &str = "▎"; pub const ONE_EIGHTH: &str = "▏"; - #[derive(Debug, Clone, Eq, PartialEq)] + #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Set { pub full: &'static str, pub seven_eighths: &'static str, @@ -62,7 +62,7 @@ pub mod bar { pub const ONE_QUARTER: &str = "▂"; pub const ONE_EIGHTH: &str = "▁"; - #[derive(Debug, Clone, Eq, PartialEq)] + #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Set { pub full: &'static str, pub seven_eighths: &'static str, @@ -155,7 +155,7 @@ pub mod line { pub const DOUBLE_CROSS: &str = "╬"; pub const THICK_CROSS: &str = "╋"; - #[derive(Debug, Clone, Eq, PartialEq)] + #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Set { pub vertical: &'static str, pub horizontal: &'static str, @@ -240,7 +240,7 @@ pub mod braille { } /// Marker to use when plotting data points -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum Marker { /// One point per cell in shape of dot #[default] @@ -265,7 +265,7 @@ pub mod scrollbar { /// │ └──────── thumb /// └─────────── begin /// ``` - #[derive(Debug, Default, Clone, Eq, PartialEq)] + #[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Set { pub track: &'static str, pub thumb: &'static str, diff --git a/src/terminal.rs b/src/terminal.rs index 17dea8d3..18c3d570 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -7,7 +7,7 @@ use crate::{ widgets::{StatefulWidget, Widget}, }; -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub enum Viewport { #[default] Fullscreen, @@ -16,14 +16,14 @@ pub enum Viewport { } /// Options to pass to [`Terminal::with_options`] -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct TerminalOptions { /// Viewport used to draw to the terminal pub viewport: Viewport, } /// Interface to the terminal backed by Termion -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Terminal where B: Backend, @@ -47,7 +47,7 @@ where } /// Represents a consistent terminal interface for rendering. -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct Frame<'a, B: 'a> where B: Backend, @@ -139,7 +139,7 @@ where /// `CompletedFrame` represents the state of the terminal after all changes performed in the last /// [`Terminal::draw`] call have been applied. Therefore, it is only valid until the next call to /// [`Terminal::draw`]. -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct CompletedFrame<'a> { pub buffer: &'a Buffer, pub area: Rect, diff --git a/src/text/grapheme.rs b/src/text/grapheme.rs index d41878f2..841145dc 100644 --- a/src/text/grapheme.rs +++ b/src/text/grapheme.rs @@ -5,7 +5,7 @@ use crate::style::{Style, Styled}; /// it actually is not a member of the text type hierarchy (`Text` -> `Line` -> `Span`). /// It is a separate type used mostly for rendering purposes. A `Span` consists of components that /// can be split into `StyledGrapheme`s, but it does not contain a collection of `StyledGrapheme`s. -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct StyledGrapheme<'a> { pub symbol: &'a str, pub style: Style, diff --git a/src/text/line.rs b/src/text/line.rs index 69ab46e2..c8201800 100644 --- a/src/text/line.rs +++ b/src/text/line.rs @@ -4,7 +4,7 @@ use std::borrow::Cow; use super::{Span, Spans, Style, StyledGrapheme}; use crate::layout::Alignment; -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Line<'a> { pub spans: Vec>, pub alignment: Option, diff --git a/src/text/span.rs b/src/text/span.rs index 297f279e..a5c4b5b9 100644 --- a/src/text/span.rs +++ b/src/text/span.rs @@ -7,7 +7,7 @@ use super::StyledGrapheme; use crate::style::{Style, Styled}; /// A string where all graphemes have the same style. -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Span<'a> { pub content: Cow<'a, str>, pub style: Style, diff --git a/src/text/spans.rs b/src/text/spans.rs index 72dc446d..e599e098 100644 --- a/src/text/spans.rs +++ b/src/text/spans.rs @@ -9,7 +9,7 @@ use crate::{layout::Alignment, text::Line}; /// future. All methods that accept Spans have been replaced with methods that /// accept Into> (which is implemented on `Spans`) to allow users of /// this crate to gradually transition to Line. -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] #[deprecated(note = "Use `ratatui::text::Line` instead")] pub struct Spans<'a>(pub Vec>); diff --git a/src/text/text.rs b/src/text/text.rs index 0fd2cdf6..1c14a7ac 100644 --- a/src/text/text.rs +++ b/src/text/text.rs @@ -28,7 +28,7 @@ use crate::style::Style; /// text.extend(Text::styled("Some more lines\nnow with more style!", style)); /// assert_eq!(6, text.height()); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Text<'a> { pub lines: Vec>, } diff --git a/src/title.rs b/src/title.rs index 9bb32a9d..f7f4736d 100644 --- a/src/title.rs +++ b/src/title.rs @@ -1,6 +1,6 @@ use crate::{layout::Alignment, text::Line}; -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Title<'a> { pub content: Line<'a>, /// Defaults to Left if unset diff --git a/src/widgets/barchart/bar.rs b/src/widgets/barchart/bar.rs index 09966bef..c66c6b1e 100644 --- a/src/widgets/barchart/bar.rs +++ b/src/widgets/barchart/bar.rs @@ -15,7 +15,7 @@ use crate::{buffer::Buffer, style::Style, text::Line}; /// .value_style(Style::default().bg(Color::Red).fg(Color::White)) /// .text_value("10°C".to_string()); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Bar<'a> { /// Value to display on the bar (computed when the data is passed to the widget) pub(super) value: u64, diff --git a/src/widgets/barchart/bar_group.rs b/src/widgets/barchart/bar_group.rs index 28fa1815..8f6e0cf5 100644 --- a/src/widgets/barchart/bar_group.rs +++ b/src/widgets/barchart/bar_group.rs @@ -10,7 +10,7 @@ use crate::text::Line; /// .label("Group 1".into()) /// .bars(&[Bar::default().value(200), Bar::default().value(150)]); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct BarGroup<'a> { /// label of the group. It will be printed centered under this group of bars pub(super) label: Option>, diff --git a/src/widgets/barchart/mod.rs b/src/widgets/barchart/mod.rs index 8bd89b2b..b9eecfec 100644 --- a/src/widgets/barchart/mod.rs +++ b/src/widgets/barchart/mod.rs @@ -28,7 +28,7 @@ use super::{Block, Widget}; /// .data(BarGroup::default().bars(&[Bar::default().value(10), Bar::default().value(20)])) /// .max(4); /// ``` -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct BarChart<'a> { /// Block to wrap the widget in block: Option>, diff --git a/src/widgets/block.rs b/src/widgets/block.rs index 0d5aa5bf..5589211b 100644 --- a/src/widgets/block.rs +++ b/src/widgets/block.rs @@ -10,7 +10,7 @@ use crate::{ widgets::{Borders, Widget}, }; -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum BorderType { #[default] Plain, @@ -113,7 +113,7 @@ impl Padding { /// .border_type(BorderType::Rounded) /// .style(Style::default().bg(Color::Black)); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Block<'a> { /// List of titles titles: Vec>, diff --git a/src/widgets/calendar.rs b/src/widgets/calendar.rs index 76ed2de9..df4119d1 100644 --- a/src/widgets/calendar.rs +++ b/src/widgets/calendar.rs @@ -21,7 +21,7 @@ use crate::{ }; /// Display a month calendar for the month containing `display_date` -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Monthly<'a, S: DateStyler> { display_date: Date, events: S, diff --git a/src/widgets/canvas/map.rs b/src/widgets/canvas/map.rs index 3347a707..37055c0a 100644 --- a/src/widgets/canvas/map.rs +++ b/src/widgets/canvas/map.rs @@ -6,7 +6,7 @@ use crate::{ }, }; -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum MapResolution { #[default] Low, @@ -23,7 +23,7 @@ impl MapResolution { } /// Shape to draw a world map with the given resolution and color -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Map { pub resolution: MapResolution, pub color: Color, diff --git a/src/widgets/canvas/mod.rs b/src/widgets/canvas/mod.rs index b63d72e2..8b4c94ff 100644 --- a/src/widgets/canvas/mod.rs +++ b/src/widgets/canvas/mod.rs @@ -36,7 +36,7 @@ pub struct Label<'a> { line: TextLine<'a>, } -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] struct Layer { string: String, colors: Vec, @@ -51,7 +51,7 @@ trait Grid: Debug { fn reset(&mut self); } -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] struct BrailleGrid { width: u16, height: u16, @@ -114,7 +114,7 @@ impl Grid for BrailleGrid { } } -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] struct CharGrid { width: u16, height: u16, diff --git a/src/widgets/chart.rs b/src/widgets/chart.rs index 75d009e8..2dd19fdc 100644 --- a/src/widgets/chart.rs +++ b/src/widgets/chart.rs @@ -76,7 +76,7 @@ impl<'a> Axis<'a> { } /// Used to determine which style of graphing to use -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum GraphType { /// Draw each point #[default] @@ -132,7 +132,7 @@ impl<'a> Dataset<'a> { /// A container that holds all the infos about where to display each elements of the chart (axis, /// labels, legend, ...). -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] struct ChartLayout { /// Location of the title of the x axis title_x: Option<(u16, u16)>, diff --git a/src/widgets/clear.rs b/src/widgets/clear.rs index 8e6a5437..b4206422 100644 --- a/src/widgets/clear.rs +++ b/src/widgets/clear.rs @@ -23,7 +23,7 @@ use crate::{buffer::Buffer, layout::Rect, widgets::Widget}; /// /// For a more complete example how to utilize `Clear` to realize popups see /// the example `examples/popup.rs` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Clear; impl Widget for Clear { diff --git a/src/widgets/list.rs b/src/widgets/list.rs index 06f0fc5a..5b07e539 100644 --- a/src/widgets/list.rs +++ b/src/widgets/list.rs @@ -8,7 +8,7 @@ use crate::{ widgets::{Block, StatefulWidget, Widget}, }; -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct ListState { offset: usize, selected: Option, @@ -45,7 +45,7 @@ impl ListState { } } -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct ListItem<'a> { content: Text<'a>, style: Style, @@ -90,7 +90,7 @@ impl<'a> ListItem<'a> { /// .highlight_style(Style::default().add_modifier(Modifier::ITALIC)) /// .highlight_symbol(">>"); /// ``` -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct List<'a> { block: Option>, items: Vec>, diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index 127ddeb0..9e5e5ae0 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -53,7 +53,7 @@ use crate::{buffer::Buffer, layout::Rect}; bitflags! { /// Bitflags that can be composed to set the visible borders essentially on the block widget. - #[derive(Default, Clone, Copy, Eq, PartialEq)] + #[derive(Default, Clone, Copy, Eq, PartialEq, Hash)] pub struct Borders: u8 { /// Show no border (default) const NONE = 0b0000; diff --git a/src/widgets/paragraph.rs b/src/widgets/paragraph.rs index f5db8bd5..43707c21 100644 --- a/src/widgets/paragraph.rs +++ b/src/widgets/paragraph.rs @@ -42,7 +42,7 @@ fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment) /// .alignment(Alignment::Center) /// .wrap(Wrap { trim: true }); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Paragraph<'a> { /// A block to wrap the widget in block: Option>, @@ -85,7 +85,7 @@ pub struct Paragraph<'a> { /// // - Here is another point /// // that is long enough to wrap /// ``` -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub struct Wrap { /// Should leading whitespace be trimmed pub trim: bool, diff --git a/src/widgets/scrollbar.rs b/src/widgets/scrollbar.rs index c914958b..356edcf4 100644 --- a/src/widgets/scrollbar.rs +++ b/src/widgets/scrollbar.rs @@ -7,7 +7,7 @@ use crate::{ }; /// An enum representing the direction of scrolling in a Scrollbar widget. -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum ScrollDirection { /// Forward scroll direction, usually corresponds to scrolling downwards or rightwards. #[default] @@ -35,7 +35,7 @@ pub enum ScrollDirection { /// /// If you don't have multi-line content, you can leave the `viewport_content_length` set to the /// default of 0 and it'll use the track size as a `viewport_content_length`. -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub struct ScrollbarState { // The current position within the scrollable content. position: u16, @@ -101,7 +101,7 @@ impl ScrollbarState { } /// Scrollbar Orientation -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub enum ScrollbarOrientation { #[default] VerticalRight, @@ -122,7 +122,7 @@ pub enum ScrollbarOrientation { /// │ └──────── thumb /// └─────────── begin /// ``` -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct Scrollbar<'a> { orientation: ScrollbarOrientation, thumb_style: Style, diff --git a/src/widgets/sparkline.rs b/src/widgets/sparkline.rs index 92cbd6bc..1e32cec4 100644 --- a/src/widgets/sparkline.rs +++ b/src/widgets/sparkline.rs @@ -38,7 +38,7 @@ pub struct Sparkline<'a> { direction: RenderDirection, } -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)] pub enum RenderDirection { #[default] LeftToRight, diff --git a/src/widgets/table.rs b/src/widgets/table.rs index bc4e5d11..d12ec67b 100644 --- a/src/widgets/table.rs +++ b/src/widgets/table.rs @@ -32,7 +32,7 @@ use crate::{ /// /// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling /// capabilities of [`Text`]. -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Cell<'a> { content: Text<'a>, style: Style, @@ -99,7 +99,7 @@ impl<'a> Styled for Cell<'a> { /// ``` /// /// By default, a row has a height of 1 but you can change this using [`Row::height`]. -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Row<'a> { cells: Vec>, height: u16, @@ -211,7 +211,7 @@ impl<'a> Styled for Row<'a> { /// // ...and potentially show a symbol in front of the selection. /// .highlight_symbol(">>"); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Table<'a> { /// A block to wrap the widget in block: Option>, @@ -372,7 +372,7 @@ impl<'a> Styled for Table<'a> { } } -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct TableState { offset: usize, selected: Option, diff --git a/src/widgets/tabs.rs b/src/widgets/tabs.rs index 39d113f8..1a15f4db 100644 --- a/src/widgets/tabs.rs +++ b/src/widgets/tabs.rs @@ -23,7 +23,7 @@ use crate::{ /// .highlight_style(Style::default().fg(Color::Yellow)) /// .divider(DOT); /// ``` -#[derive(Debug, Default, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)] pub struct Tabs<'a> { /// A block to wrap this widget in if necessary block: Option>,