Skip to content

Commit

Permalink
feat: add rest of primitive types for trait conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
RoloEdits committed Jan 8, 2025
1 parent 28a857b commit 4b64912
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions helix-core/src/shellwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,30 @@ impl FlagValue<'_> for u128 {
}
}

impl FlagValue<'_> for usize {
fn from_str(value: &str) -> anyhow::Result<Self> {
Ok(value.parse()?)
}
}

impl FlagValue<'_> for isize {
fn from_str(value: &str) -> anyhow::Result<Self> {
Ok(value.parse()?)
}
}

impl FlagValue<'_> for f32 {
fn from_str(value: &str) -> anyhow::Result<Self> {
Ok(value.parse()?)
}
}

impl FlagValue<'_> for f64 {
fn from_str(value: &str) -> anyhow::Result<Self> {
Ok(value.parse()?)
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down

0 comments on commit 4b64912

Please sign in to comment.