Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiburt committed Feb 3, 2025
1 parent f3277c9 commit 795def4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 3 deletions.
26 changes: 25 additions & 1 deletion tabled/src/settings/object/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
//! This module contains a list of primitives that implement a [`Object`] trait.
//! This module contains a list of primitives that implement a [`Object`] trait.\
//! They help to locate a necessary segment on a [`Table`].
//!
//! # Example
//!
//! ```
//! use tabled::{
//! settings::{
//! object::{Columns, Object, Rows},
//! Alignment,
//! },
//! Table,
//! };
//! use testing_table::assert_table;
//!
//! let data = [
//! [1, 2, 3, 4, 5],
//! [10, 20, 30, 40, 50],
//! [100, 200, 300, 400, 500],
//! ];
//!
//! let mut table = Table::new(data);
//! table.modify(Rows::first().not(Columns::first()), Alignment::right());
//!
//! assert_table!(table, "");
//! ```
//!
//! [`Table`]: crate::Table
mod cell;
Expand Down
21 changes: 19 additions & 2 deletions testing_table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Includes
- `assert_table!`
- `assert_width!`

An example.

```rust
use testing_table::{test_table, assert_table, static_table};

test_table!(
test_tabled,
tabled::Table::new([[1, 2, 3]]),
Expand All @@ -21,4 +21,21 @@ test_table!(
"| 1 | 2 | 3 |"
"+---+---+---+"
);

assert_table!(
tabled::Table::new([[1, 2, 3]]),
"+---+---+---+"
"| 0 | 1 | 2 |"
"+---+---+---+"
"| 1 | 2 | 3 |"
"+---+---+---+"
);

static_table!(
"+---+---+---+"
"| 0 | 1 | 2 |"
"+---+---+---+"
"| 1 | 2 | 3 |"
"+---+---+---+"
);
```
39 changes: 39 additions & 0 deletions testing_table/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
//! Crate provides a convinient functions for work with tables.
//!
//! ```ignore
//! use testing_table::test_table;
//!
//! test_table!(
//! test_tabled,
//! tabled::Table::new([[1, 2, 3]]),
//! "+---+---+---+"
//! "| 0 | 1 | 2 |"
//! "+---+---+---+"
//! "| 1 | 2 | 3 |"
//! "+---+---+---+"
//! );
//! ```
//!
//! ```ignore
//! use testing_table::assert_table;
//!
//! assert_table!(
//! tabled::Table::new([[1, 2, 3]]),
//! "+---+---+---+"
//! "| 0 | 1 | 2 |"
//! "+---+---+---+"
//! "| 1 | 2 | 3 |"
//! "+---+---+---+"
//! );
//! ```
//!
//! ```
//! use testing_table::static_table;
//!
//! static_table!(
//! "+---+---+---+"
//! "| 0 | 1 | 2 |"
//! "+---+---+---+"
//! "| 1 | 2 | 3 |"
//! "+---+---+---+"
//! );
//! ```
//!
//! It was developed as a sub-project of [`tabled`].
//!
//! [`tabled`]: https://github.com/zhiburt/tabled
Expand Down

0 comments on commit 795def4

Please sign in to comment.