Skip to content

Commit

Permalink
args: impl TryInto for Option<Args>
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Jul 31, 2024
1 parent bcb2893 commit 210082e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ impl TryInto<Args> for &String {
}
}

impl TryInto<Args> for Option<String> {
type Error = Error;

fn try_into(self) -> Result<Args, Self::Error> {
match self {
Some(s) => s.parse(),
None => Ok(Args::new()),
}
}
}

impl From<&Args> for Args {
fn from(value: &Args) -> Self {
value.clone()
Expand Down

0 comments on commit 210082e

Please sign in to comment.