From 4b64912d270909c8a42b16d9d4a1fffc4bc77fa5 Mon Sep 17 00:00:00 2001 From: Rolo Date: Wed, 8 Jan 2025 04:56:39 -0800 Subject: [PATCH] feat: add rest of primitive types for trait conversion --- helix-core/src/shellwords.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index da872fd1c663..e54d99c1836b 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -869,6 +869,30 @@ impl FlagValue<'_> for u128 { } } +impl FlagValue<'_> for usize { + fn from_str(value: &str) -> anyhow::Result { + Ok(value.parse()?) + } +} + +impl FlagValue<'_> for isize { + fn from_str(value: &str) -> anyhow::Result { + Ok(value.parse()?) + } +} + +impl FlagValue<'_> for f32 { + fn from_str(value: &str) -> anyhow::Result { + Ok(value.parse()?) + } +} + +impl FlagValue<'_> for f64 { + fn from_str(value: &str) -> anyhow::Result { + Ok(value.parse()?) + } +} + #[cfg(test)] mod test { use super::*;