From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/tabled/src/settings/style/mod.rs | 127 ++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 vendor/tabled/src/settings/style/mod.rs (limited to 'vendor/tabled/src/settings/style/mod.rs') diff --git a/vendor/tabled/src/settings/style/mod.rs b/vendor/tabled/src/settings/style/mod.rs new file mode 100644 index 000000000..b8d7f688d --- /dev/null +++ b/vendor/tabled/src/settings/style/mod.rs @@ -0,0 +1,127 @@ +//! This module contains a list of primitives which can be applied to change [`Table`] style. +//! +//! ## [`Style`] +//! +//! It is responsible for a table border style. +//! An individual cell border can be set by [`Border`]. +//! +//! ### Example +//! +#![cfg_attr(feature = "std", doc = "```")] +#![cfg_attr(not(feature = "std"), doc = "```ignore")] +//! use tabled::{Table, settings::Style}; +//! +//! let data = vec!["Hello", "2022"]; +//! let mut table = Table::new(&data); +//! table.with(Style::psql()); +//! +//! assert_eq!( +//! table.to_string(), +//! concat!( +//! " &str \n", +//! "-------\n", +//! " Hello \n", +//! " 2022 ", +//! ) +//! ) +//! ``` +//! +//! ## [`BorderText`] +//! +//! It's used to override a border with a custom text. +//! +//! ### Example +//! +#![cfg_attr(feature = "std", doc = "```")] +#![cfg_attr(not(feature = "std"), doc = "```ignore")] +//! use tabled::{Table, settings::style::{BorderText, Style}}; +//! +//! let data = vec!["Hello", "2022"]; +//! let table = Table::new(&data) +//! .with(Style::psql()) +//! .with(BorderText::new("Santa").horizontal(1)) +//! .to_string(); +//! +//! assert_eq!( +//! table, +//! concat!( +//! " &str \n", +//! "Santa--\n", +//! " Hello \n", +//! " 2022 ", +//! ) +//! ) +//! ``` +//! +//! ## [`Border`] +//! +//! [`Border`] can be used to modify cell's borders. +//! +//! It's possible to set a collored border when `color` feature is on. +//! +//! ### Example +//! +#![cfg_attr(feature = "std", doc = "```")] +#![cfg_attr(not(feature = "std"), doc = "```ignore")] +//! use tabled::{Table, settings::{Modify, Style}}; +//! +//! let data = vec!["Hello", "2022"]; +//! let table = Table::new(&data) +//! .with(Style::psql()) +//! .with(Modify::new((0, 0)).with(Style::modern().get_frame())) +//! .to_string(); +//! +//! assert_eq!( +//! table, +//! concat!( +//! "┌───────┐\n", +//! "│ &str │\n", +//! "└───────┘\n", +//! " Hello \n", +//! " 2022 ", +//! ) +//! ) +//! ``` +//! +//! ## [`RawStyle`] +//! +//! A different representation of [`Style`]. +//! With no checks in place. +//! +//! It also contains a list of types to support colors. +//! +//! [`Table`]: crate::Table +//! [`BorderText`]: crate::settings::style::BorderText +//! [`RawStyle`]: crate::settings::style::RawStyle + +#[cfg(feature = "std")] +mod border; +#[cfg(feature = "std")] +mod border_char; +#[cfg(feature = "std")] +mod border_color; +#[cfg(feature = "std")] +mod border_text; +#[cfg(feature = "std")] +mod offset; +#[cfg(feature = "std")] +mod raw_style; +#[cfg(feature = "std")] +mod span_border_correction; + +mod builder; +mod horizontal_line; +mod line; +mod vertical_line; + +#[cfg(feature = "std")] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] +pub use self::{ + border::Border, border_char::BorderChar, border_color::BorderColor, border_text::BorderText, + offset::Offset, raw_style::RawStyle, span_border_correction::BorderSpanCorrection, +}; + +pub use builder::{HorizontalLineIter, On, Style, VerticalLineIter}; +pub use horizontal_line::HorizontalLine; +pub use line::Line; +pub use vertical_line::VerticalLine; -- cgit v1.2.3