Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing args for a parsed ICU string #9

Open
bbqsrc opened this issue Sep 27, 2018 · 2 comments
Open

Accessing args for a parsed ICU string #9

bbqsrc opened this issue Sep 27, 2018 · 2 comments

Comments

@bbqsrc
Copy link

bbqsrc commented Sep 27, 2018

I am writing a wrapper for string formatting, so that a string like There are {foo} apples. with an identifier some_string can be accessed like so in Rust:

pub fn some_string(foo: &str) -> String {
    ...
}

Right now it does not seem possible to access Args from anywhere because they are not attached to any struct but generated on the fly by a macro.

What is the suggested course of action for getting access to the Args at the moment? I don't mind if it's a bit round-about, as it will only be used from a build.rs script. Thanks!

@waywardmonkeys
Copy link
Contributor

Sorry, I was away for the weekend.

What do you want to do with the args? Your example mentioned a variable foo, but an identifier some_string, so I am not sure what you're looking to do.

@bbqsrc
Copy link
Author

bbqsrc commented Sep 30, 2018

Assume a JSON document which defines key-value pairs of translatable strings of:

{
    "some_string": "There are {foo} apples."
}

I need access to the Args object so that I can generate the function described in my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants