summaryrefslogtreecommitdiffstats
path: root/vendor/tabled/examples/highlight.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/tabled/examples/highlight.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tabled/examples/highlight.rs')
-rw-r--r--vendor/tabled/examples/highlight.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/tabled/examples/highlight.rs b/vendor/tabled/examples/highlight.rs
new file mode 100644
index 000000000..0b6abb8ad
--- /dev/null
+++ b/vendor/tabled/examples/highlight.rs
@@ -0,0 +1,28 @@
+//! This example demonstrates using the [`Highlight`] [`TableOption`] to
+//! decorate sections of a [`Table`] with a unique [`Border`].
+//!
+//! * Note how [`Highlight`] arguments can be chained together to
+//! create cross-sections and non-symmetrical shapes.
+
+use tabled::{
+ settings::{
+ object::{Columns, Object, Rows},
+ style::{Border, Style},
+ Highlight,
+ },
+ Table,
+};
+
+fn main() {
+ let data = vec![["A", "B", "C"], ["D", "E", "F"], ["G", "H", "I"]];
+
+ let table = Table::new(data)
+ .with(Style::modern())
+ .with(Highlight::new(
+ Rows::first().and(Columns::single(1)),
+ Border::filled('*'),
+ ))
+ .to_string();
+
+ println!("{table}");
+}