summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2018-02-19 13:22:06 +0100
committerPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2018-02-19 13:22:06 +0100
commitf38be5c886e2462f074ce849eb9aa6815900a7e3 (patch)
tree93b9ae2d5f847d218406e545d4cf1691bc7e6def
parent75eff50f57b322cdcdd3a39271666c6df06e68a7 (diff)
Derive hash on public types
-rw-r--r--.travis.yml1
-rw-r--r--src/cell.rs2
-rw-r--r--src/format.rs10
-rw-r--r--src/lib.rs4
-rw-r--r--src/row.rs2
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<String>,
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<char>,
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<TableFormat>,
titles: Box<Option<Row>>,
@@ -62,7 +62,7 @@ pub struct Table {
/// # }
/// ```
///
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, Hash)]
pub struct TableSlice<'a> {
format: &'a TableFormat,
titles: &'a Option<Row>,
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<Cell>,
}