Skip to content

Creating Args from owned values slice #10

@dvtomas

Description

@dvtomas

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions