diff options
author | pierresy <phsym@msn.com> | 2016-01-04 21:10:21 +0100 |
---|---|---|
committer | pierresy <phsym@msn.com> | 2016-01-04 21:10:21 +0100 |
commit | 51a45a48e53d7cc826ad31cae3cb68acfbb284df (patch) | |
tree | 8e41205fa0906f275c1ab25e7cc3f3675c67c13b /README.md | |
parent | d9c2ce1791a2f653570bee193b4d7b2a9223a568 (diff) |
Updated readme with some explanation about table slicing (#10)
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -195,4 +195,25 @@ Capital letters are for **bright** colors. Eg : * **B** : Bright Blue
* ... and so on ...
+## Slicing
+
+Tables can be sliced into immutable borrowed subtables.
+Slices are of type `prettytable::TableSlice<'a>`.
+
+For example
+```rust
+use prettytable::Slice;
+(...)
+let slice = table.slice(2..5);
+table.printstd();
+```
+Would print a table with only lines 2, 3 and 4 from `table`.
+
+Other `Range` syntax are supported. For example :
+```rust
+table.slice(..); // Returns a borrowed immutable table with all rows
+table.slice(2..); // Returns a table with rows starting at index 2
+table.slice(..3); // Returns a table with rows until the one at index 3
+```
+
Additional examples are provided in documentation and in [examples](./examples/) directory
|