Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jan 29, 2025
1 parent ed14645 commit 6168f9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/style/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum TableComponent {
}

impl TableComponent {
pub fn components() -> impl Iterator<Item = TableComponent> {
const fn components() -> [TableComponent; 19] {
[
TableComponent::LeftBorder,
TableComponent::RightBorder,
Expand All @@ -90,6 +90,9 @@ impl TableComponent {
TableComponent::BottomLeftCorner,
TableComponent::BottomRightCorner,
]
.into_iter()
}

pub fn iter() -> impl Iterator<Item = TableComponent> {
TableComponent::components().into_iter()
}
}
6 changes: 3 additions & 3 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl Table {
///
/// If the string is too long, remaining charaacters will be simply ignored.
pub fn load_preset(&mut self, preset: &str) -> &mut Self {
let mut components = TableComponent::components();
let mut components = TableComponent::iter();

for character in preset.chars() {
if let Some(component) = components.next() {
Expand Down Expand Up @@ -488,7 +488,7 @@ impl Table {
/// assert_eq!(UTF8_FULL, table.current_style_as_preset())
/// ```
pub fn current_style_as_preset(&mut self) -> String {
let components = TableComponent::components();
let components = TableComponent::iter();
let mut preset_string = String::new();

for component in components {
Expand All @@ -515,7 +515,7 @@ impl Table {
/// table.apply_modifier(UTF8_ROUND_CORNERS);
/// ```
pub fn apply_modifier(&mut self, modifier: &str) -> &mut Self {
let mut components = TableComponent::components();
let mut components = TableComponent::iter();

for character in modifier.chars() {
// Skip spaces while applying modifiers.
Expand Down

0 comments on commit 6168f9f

Please # to comment.