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

FR: Implement AsRef<str> for Painted<&str> #43

Open
ogarcia opened this issue May 10, 2024 · 0 comments
Open

FR: Implement AsRef<str> for Painted<&str> #43

ogarcia opened this issue May 10, 2024 · 0 comments

Comments

@ogarcia
Copy link

ogarcia commented May 10, 2024

First of all, if you don't see it, just close the issue, because I may be asking you to complicate it too much.

The idea is that you can do something like this:

use yansi::Paint;

fn print_message<M: AsRef<str>>(message: M) {
    println!("{}", message.as_ref());
}

fn main() {
    print_message("Hello");
    print_message("World".red());
}
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

1 participant