Skip to content

Commit

Permalink
Merge pull request #169 from tisonkun/reduce-deps
Browse files Browse the repository at this point in the history
chore: reduce proc-macro dep strum
  • Loading branch information
Nukesor authored Jan 29, 2025
2 parents 493dfb0 + 6168f9f commit 19e29c5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ integration_test = []
[dependencies]
ansi-str = { version = "0.8", optional = true }
console = { version = "0.15", optional = true }
strum = "0.26"
strum_macros = "0.26"
unicode-width = "0.2"

[dev-dependencies]
Expand Down
34 changes: 31 additions & 3 deletions src/style/table.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use strum_macros::EnumIter;

/// Specify how comfy_table should arrange the content in your table.
///
/// ```
Expand Down Expand Up @@ -46,7 +44,7 @@ pub enum ContentArrangement {
/// | | | | The inner "+" chars are MiddleIntersections
/// +---+---+---+
/// ```
#[derive(Debug, PartialEq, Eq, Hash, EnumIter, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub enum TableComponent {
LeftBorder,
RightBorder,
Expand All @@ -68,3 +66,33 @@ pub enum TableComponent {
BottomLeftCorner,
BottomRightCorner,
}

impl TableComponent {
const fn components() -> [TableComponent; 19] {
[
TableComponent::LeftBorder,
TableComponent::RightBorder,
TableComponent::TopBorder,
TableComponent::BottomBorder,
TableComponent::LeftHeaderIntersection,
TableComponent::HeaderLines,
TableComponent::MiddleHeaderIntersections,
TableComponent::RightHeaderIntersection,
TableComponent::VerticalLines,
TableComponent::HorizontalLines,
TableComponent::MiddleIntersections,
TableComponent::LeftBorderIntersections,
TableComponent::RightBorderIntersections,
TableComponent::TopBorderIntersections,
TableComponent::BottomBorderIntersections,
TableComponent::TopLeftCorner,
TableComponent::TopRightCorner,
TableComponent::BottomLeftCorner,
TableComponent::BottomRightCorner,
]
}

pub fn iter() -> impl Iterator<Item = TableComponent> {
TableComponent::components().into_iter()
}
}
1 change: 0 additions & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::slice::{Iter, IterMut};
use crossterm::terminal;
#[cfg(feature = "tty")]
use crossterm::tty::IsTty;
use strum::IntoEnumIterator;

use crate::cell::Cell;
use crate::column::Column;
Expand Down

0 comments on commit 19e29c5

Please sign in to comment.