refactor: simplify FromStr implementations with strum

This commit is contained in:
sxyazi 2026-04-03 09:13:52 +08:00
parent 4857d46918
commit ad655eda52
No known key found for this signature in database
31 changed files with 108 additions and 231 deletions

View file

@ -16,9 +16,9 @@ workspace = true
yazi-macro = { path = "../yazi-macro", version = "26.2.2" }
# External dependencies
crossterm = { workspace = true }
ratatui = { workspace = true }
twox-hash = { workspace = true }
crossterm = { workspace = true }
ratatui = { workspace = true }
twox-hash = { workspace = true }
unicode-width = { workspace = true }
[dependencies.unicode-segmentation]

View file

@ -1,3 +1,3 @@
yazi_macro::mod_pub!(crossterm ratatui);
yazi_macro::mod_pub!(crossterm ratatui strum);
yazi_macro::mod_flat!(twox);

View file

@ -0,0 +1 @@
yazi_macro::mod_flat!(traits);

View file

@ -0,0 +1,10 @@
pub trait IntoStr {
fn into_str(self) -> &'static str;
}
impl<T> IntoStr for T
where
T: Into<&'static str>,
{
fn into_str(self) -> &'static str { self.into() }
}