From cf7dca33e2e2131c20e4bbc34ad222c5e6edc29a Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Mon, 26 Aug 2019 23:48:51 +0200 Subject: Privatize deprecated functions functions for #87 --- src/cell.rs | 16 ++++++++-------- src/format.rs | 8 ++++---- src/lib.rs | 9 +++++---- src/row.rs | 20 ++++++++++---------- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/cell.rs b/src/cell.rs index 4b54f19..39c418b 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -176,14 +176,14 @@ impl Cell { } /// Return the height of the cell - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_height(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn get_height(&self) -> usize { self.content.len() } /// Return the width of the cell - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_width(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn get_width(&self) -> usize { self.width } @@ -206,8 +206,8 @@ impl Cell { /// `idx` is the line index to print. `col_width` is the column width used to /// fill the cells with blanks so it fits in the table. /// If `ìdx` is higher than this cell's height, it will print empty content - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print( + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print( &self, out: &mut T, idx: usize, @@ -219,8 +219,8 @@ impl Cell { } /// Apply style then call `print` to print the cell into a terminal - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print_term( + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print_term( &self, out: &mut T, idx: usize, diff --git a/src/format.rs b/src/format.rs index 9339348..10bee26 100644 --- a/src/format.rs +++ b/src/format.rs @@ -220,8 +220,8 @@ impl TableFormat { /// Print a full line separator to `out`. `col_width` is a slice containing the width of each column. /// Returns the number of printed lines - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print_line_separator(&self, + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print_line_separator(&self, out: &mut T, col_width: &[usize], pos: LinePosition) @@ -252,8 +252,8 @@ impl TableFormat { } /// Print a column separator or a table border - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print_column_separator(&self, + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print_column_separator(&self, out: &mut T, pos: ColumnPosition) -> Result<(), Error> { diff --git a/src/lib.rs b/src/lib.rs index 11b4ed4..977f58d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,8 +68,8 @@ pub struct TableSlice<'a> { impl<'a> TableSlice<'a> { /// Compute and return the number of column - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_column_num(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + fn get_column_num(&self) -> usize { let mut cnum = 0; for r in self.rows { let l = r.column_count(); @@ -256,8 +256,9 @@ impl Table { } /// Compute and return the number of column - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_column_num(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + #[cfg(test)] // Only used for testing for now + pub (crate) fn get_column_num(&self) -> usize { self.as_ref().get_column_num() } diff --git a/src/row.rs b/src/row.rs index d3a9d86..ae14429 100644 --- a/src/row.rs +++ b/src/row.rs @@ -31,8 +31,8 @@ impl Row { /// Count the number of column required in the table grid. /// It takes into account horizontal spanning of cells. For /// example, a cell with an hspan of 3 will add 3 column to the grid - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn column_count(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn column_count(&self) -> usize { self.cells.iter().map(|c| c.get_hspan()).sum() } @@ -48,8 +48,8 @@ impl Row { } /// Get the height of this row - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_height(&self) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + fn get_height(&self) -> usize { let mut height = 1; // Minimum height must be 1 to print empty rows for cell in &self.cells { let h = cell.get_height(); @@ -62,8 +62,8 @@ impl Row { /// Get the minimum width required by the cell in the column `column`. /// Return 0 if the cell does not exist in this row - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn get_column_width(&self, column: usize, format: &TableFormat) -> usize { + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn get_column_width(&self, column: usize, format: &TableFormat) -> usize { let mut i = 0; for c in &self.cells { if i + c.get_hspan() > column { @@ -186,8 +186,8 @@ impl Row { /// Print the row to `out`, with `separator` as column separator, and `col_width` /// specifying the width of each columns. Returns the number of printed lines - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print(&self, + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print(&self, out: &mut T, format: &TableFormat, col_width: &[usize]) @@ -197,8 +197,8 @@ impl Row { /// Print the row to terminal `out`, with `separator` as column separator, and `col_width` /// specifying the width of each columns. Apply style when needed. returns the number of printed lines - #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] - pub fn print_term(&self, + // #[deprecated(since="0.8.0", note="Will become private in future release. See [issue #87](https://github.com/phsym/prettytable-rs/issues/87)")] + pub (crate) fn print_term(&self, out: &mut T, format: &TableFormat, col_width: &[usize]) -- cgit v1.2.3