endoli / endoli/message-format.rs

Creating Args from owned values slice

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi,
I have a (for simplicity) `&[(String, String)]`, where first String corresponds to `Args::name` and the second String corresponds to `Args::Value` (of type `Value::Str`). How do I convert this to the `Args` struct? I can't get around the `pub prev: Option<&'a Args<'a>>` reference hell in the `Args` struct.

That is, I need to implement

```rust
fn to_args(args: &[(String, String)]) -> Args {
unimplemented!()
}
```

Any idea? Thank you.

Edit: It does not need to actually be a function. I'll use the resulting args to format the message immediately, so if there's a way to produce the Args inline, I'd be happy with that as well.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.