Skip to content

Commit

Permalink
Implement Default trait for rustywind_core::sorter::Options
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Oct 23, 2024
1 parent dcf5151 commit b485c08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions rustywind-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Changed `HowClassesAreWrapped` to `ClassWrapping`
- Fixed some clippy warnings
- Implemented `Default` for `Options`

## [0.2.0] - 2024-10-21

Expand Down
11 changes: 11 additions & 0 deletions rustywind-core/src/sorter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ pub struct Options {
pub class_wrapping: ClassWrapping,
}

impl Default for Options {
fn default() -> Self {
Self {
regex: FinderRegex::DefaultRegex,
sorter: Sorter::DefaultSorter,
allow_duplicates: false,
class_wrapping: ClassWrapping::NoWrapping,
}
}
}

/// Checks if the file contents have any classes.
pub fn has_classes(file_contents: &str, options: &Options) -> bool {
options.regex.is_match(file_contents)
Expand Down

0 comments on commit b485c08

Please sign in to comment.