From f38be5c886e2462f074ce849eb9aa6815900a7e3 Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Mon, 19 Feb 2018 13:22:06 +0100 Subject: Derive hash on public types --- .travis.yml | 1 + src/cell.rs | 2 +- src/format.rs | 10 +++++----- src/lib.rs | 4 ++-- src/row.rs | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 098b3ca..3266656 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rust: - 1.20.0 - 1.21.0 - 1.22.1 +- 1.23.0 - stable - beta - nightly diff --git a/src/cell.rs b/src/cell.rs index ec9deb7..ef75433 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -11,7 +11,7 @@ use super::utils::print_align; /// /// Once created, a cell's content cannot be modified. /// The cell would have to be replaced by another one -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Hash)] pub struct Cell { content: Vec, width: usize, diff --git a/src/format.rs b/src/format.rs index 5944f83..4e7a671 100644 --- a/src/format.rs +++ b/src/format.rs @@ -7,7 +7,7 @@ use encode_unicode::Utf8Char; use super::utils::NEWLINE; /// Alignment for cell's content -#[derive(Clone, Debug, PartialEq, Copy)] +#[derive(Clone, Debug, PartialEq, Copy, Hash)] pub enum Alignment { /// Align left LEFT, @@ -18,7 +18,7 @@ pub enum Alignment { } /// Position of a line separator in a table -#[derive(Clone, Debug, PartialEq, Copy)] +#[derive(Clone, Debug, PartialEq, Copy, Hash)] pub enum LinePosition { /// Table's border on top Top, @@ -32,7 +32,7 @@ pub enum LinePosition { } /// Position of a column separator in a row -#[derive(Clone, Debug, PartialEq, Copy)] +#[derive(Clone, Debug, PartialEq, Copy, Hash)] pub enum ColumnPosition { /// Left table's border Left, @@ -43,7 +43,7 @@ pub enum ColumnPosition { } /// Contains the character used for printing a line separator -#[derive(Clone, Debug, Copy)] +#[derive(Clone, Debug, Copy, Hash)] pub struct LineSeparator { /// Line separator line: char, @@ -113,7 +113,7 @@ impl Default for LineSeparator { } /// Contains the table formatting rules -#[derive(Clone, Debug, Copy)] +#[derive(Clone, Debug, Copy, Hash)] pub struct TableFormat { /// Optional column separator character csep: Option, diff --git a/src/lib.rs b/src/lib.rs index ae90adb..d6c22ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ use format::{TableFormat, LinePosition, consts}; use utils::StringWriter; /// An owned printable table -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Hash)] pub struct Table { format: Box, titles: Box>, @@ -62,7 +62,7 @@ pub struct Table { /// # } /// ``` /// -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Hash)] pub struct TableSlice<'a> { format: &'a TableFormat, titles: &'a Option, diff --git a/src/row.rs b/src/row.rs index 86b7d68..28bed2a 100644 --- a/src/row.rs +++ b/src/row.rs @@ -11,7 +11,7 @@ use super::cell::Cell; use super::format::{TableFormat, ColumnPosition}; /// Represent a table row made of cells -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Hash)] pub struct Row { cells: Vec, } -- cgit v1.2.3