From bb7843308e84d3f4007b848e1186a5a62ec2f94b Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Sat, 26 Oct 2024 16:30:23 +0300 Subject: [PATCH 1/2] Move util utf8_writer to outer module --- tabled/Cargo.toml | 4 ++-- tabled/src/tables/compact.rs | 2 +- tabled/src/tables/iter.rs | 2 +- tabled/src/tables/mod.rs | 1 - tabled/src/tables/util/mod.rs | 2 -- tabled/src/util/mod.rs | 3 +++ tabled/src/{tables => }/util/utf8_writer.rs | 0 7 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 tabled/src/tables/util/mod.rs rename tabled/src/{tables => }/util/utf8_writer.rs (100%) diff --git a/tabled/Cargo.toml b/tabled/Cargo.toml index e655cbe0..0fe12450 100644 --- a/tabled/Cargo.toml +++ b/tabled/Cargo.toml @@ -311,8 +311,8 @@ ansi = ["papergrid/ansi", "ansi-str", "ansitok", "std"] macros = ["std"] [dependencies] -papergrid = { version = "0.12", default-features = false } -tabled_derive = { version = "0.8", optional = true } +papergrid = { path = "../papergrid", default-features = false } +tabled_derive = { path = "../tabled_derive", optional = true } ansi-str = { version = "0.8", optional = true } ansitok = { version = "0.2", optional = true } diff --git a/tabled/src/tables/compact.rs b/tabled/src/tables/compact.rs index a28a6547..645e6397 100644 --- a/tabled/src/tables/compact.rs +++ b/tabled/src/tables/compact.rs @@ -221,7 +221,7 @@ impl CompactTable { D: Dimension, W: std::io::Write, { - let writer = super::util::utf8_writer::UTF8Writer::new(writer); + let writer = crate::util::utf8_writer::UTF8Writer::new(writer); self.fmt(writer) .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err)) } diff --git a/tabled/src/tables/iter.rs b/tabled/src/tables/iter.rs index 303cc867..b25f50c7 100644 --- a/tabled/src/tables/iter.rs +++ b/tabled/src/tables/iter.rs @@ -42,7 +42,7 @@ use crate::{ settings::{Style, TableOption}, }; -use super::util::utf8_writer::UTF8Writer; +use crate::util::utf8_writer::UTF8Writer; /// A table which consumes an [`IntoRecords`] iterator. /// diff --git a/tabled/src/tables/mod.rs b/tabled/src/tables/mod.rs index 1b9e9e65..55c7bcef 100644 --- a/tabled/src/tables/mod.rs +++ b/tabled/src/tables/mod.rs @@ -18,7 +18,6 @@ //! A table with a greater control of a layout. mod compact; -mod util; #[cfg(feature = "std")] mod extended; diff --git a/tabled/src/tables/util/mod.rs b/tabled/src/tables/util/mod.rs deleted file mode 100644 index ea5453b8..00000000 --- a/tabled/src/tables/util/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(feature = "std")] -pub(crate) mod utf8_writer; diff --git a/tabled/src/util/mod.rs b/tabled/src/util/mod.rs index 47ed4f33..c8b6af56 100644 --- a/tabled/src/util/mod.rs +++ b/tabled/src/util/mod.rs @@ -1,2 +1,5 @@ #[cfg(feature = "std")] pub(crate) mod string; + +#[cfg(feature = "std")] +pub(crate) mod utf8_writer; diff --git a/tabled/src/tables/util/utf8_writer.rs b/tabled/src/util/utf8_writer.rs similarity index 100% rename from tabled/src/tables/util/utf8_writer.rs rename to tabled/src/util/utf8_writer.rs From b6b6ef57a27d522b204300f72404721c6dd42922 Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Sat, 26 Oct 2024 21:32:39 +0300 Subject: [PATCH 2/2] Fix tests fail --- tabled/tests/core/table_test.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tabled/tests/core/table_test.rs b/tabled/tests/core/table_test.rs index c75b0f30..c326426e 100644 --- a/tabled/tests/core/table_test.rs +++ b/tabled/tests/core/table_test.rs @@ -740,15 +740,15 @@ mod derived { }, ] }), - "+------------------------------------+-----------------+-------------------------------+--------+" - "| name | author | text | rating |" - "+------------------------------------+-----------------+-------------------------------+--------+" - "| Rebase vs Merge commit in depth 👋 | Rose Kuphal DVM | A multiline | 43 |" - "| | | text with 🤯 😳 🥵 🥶 | |" - "| | | a bunch of emojies ☄\u{fe0f} 💥 🔥 🌪 | |" - "+------------------------------------+-----------------+-------------------------------+--------+" - "| Keep it simple | Unknown | 🍳 | 100 |" - "+------------------------------------+-----------------+-------------------------------+--------+" + "+------------------------------------+-----------------+--------------------------------+--------+" + "| name | author | text | rating |" + "+------------------------------------+-----------------+--------------------------------+--------+" + "| Rebase vs Merge commit in depth 👋 | Rose Kuphal DVM | A multiline | 43 |" + "| | | text with 🤯 😳 🥵 🥶 | |" + "| | | a bunch of emojies ☄️ 💥 🔥 🌪 | |" + "+------------------------------------+-----------------+--------------------------------+--------+" + "| Keep it simple | Unknown | 🍳 | 100 |" + "+------------------------------------+-----------------+--------------------------------+--------+" ); }