Skip to content

Commit

Permalink
change: Simplify add_row[s] examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Feb 18, 2024
1 parent 99d5b18 commit c1d1403
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ impl Table {
/// use comfy_table::{Table, Row};
///
/// let mut table = Table::new();
/// let row = Row::from(vec!["One", "Two"]);
/// table.add_row(row);
/// table.add_row(vec!["One", "Two"]);
/// ```
pub fn add_row<T: Into<Row>>(&mut self, row: T) -> &mut Self {
let mut row = row.into();
Expand All @@ -157,8 +156,7 @@ impl Table {
/// use comfy_table::{Table, Row};
///
/// let mut table = Table::new();
/// let row = Row::from(vec!["One", "Two"]);
/// table.add_row_if(|index, row| true, row);
/// table.add_row_if(|index, row| true, vec!["One", "Two"]);
/// ```
pub fn add_row_if<P, T>(&mut self, predicate: P, row: T) -> &mut Self
where
Expand All @@ -179,8 +177,8 @@ impl Table {
///
/// let mut table = Table::new();
/// let rows = vec![
/// Row::from(vec!["One", "Two"]),
/// Row::from(vec!["Three", "Four"])
/// vec!["One", "Two"],
/// vec!["Three", "Four"]
/// ];
/// table.add_rows(rows);
/// ```
Expand All @@ -206,8 +204,8 @@ impl Table {
///
/// let mut table = Table::new();
/// let rows = vec![
/// Row::from(vec!["One", "Two"]),
/// Row::from(vec!["Three", "Four"])
/// vec!["One", "Two"],
/// vec!["Three", "Four"]
/// ];
/// table.add_rows_if(|index, rows| true, rows);
/// ```
Expand Down

0 comments on commit c1d1403

Please sign in to comment.