Skip to content

Commit

Permalink
Privatize deprecated functions functions for #87
Browse files Browse the repository at this point in the history
  • Loading branch information
phsym committed Aug 26, 2019
1 parent 6bb234c commit cf7dca3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
16 changes: 8 additions & 8 deletions src/cell.rs
Expand Up @@ -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
}

Expand All @@ -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<T: Write + ?Sized>(
// #[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<T: Write + ?Sized>(
&self,
out: &mut T,
idx: usize,
Expand All @@ -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<T: Terminal + ?Sized>(
// #[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<T: Terminal + ?Sized>(
&self,
out: &mut T,
idx: usize,
Expand Down
8 changes: 4 additions & 4 deletions src/format.rs
Expand Up @@ -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<T: Write + ?Sized>(&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<T: Write + ?Sized>(&self,
out: &mut T,
col_width: &[usize],
pos: LinePosition)
Expand Down Expand Up @@ -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<T: Write + ?Sized>(&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<T: Write + ?Sized>(&self,
out: &mut T,
pos: ColumnPosition)
-> Result<(), Error> {
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Expand Up @@ -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();
Expand Down Expand Up @@ -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()
}

Expand Down
20 changes: 10 additions & 10 deletions src/row.rs
Expand Up @@ -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()
}

Expand All @@ -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();
Expand All @@ -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 {
Expand Down Expand Up @@ -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<T: Write + ?Sized>(&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<T: Write + ?Sized>(&self,
out: &mut T,
format: &TableFormat,
col_width: &[usize])
Expand All @@ -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<T: Terminal + ?Sized>(&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<T: Terminal + ?Sized>(&self,
out: &mut T,
format: &TableFormat,
col_width: &[usize])
Expand Down

0 comments on commit cf7dca3

Please sign in to comment.