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

Support storing coloured strings in other strings #45

Open
Wilfred opened this issue Dec 24, 2018 · 5 comments
Open

Support storing coloured strings in other strings #45

Wilfred opened this issue Dec 24, 2018 · 5 comments

Comments

@Wilfred
Copy link

Wilfred commented Dec 24, 2018

I'd expected to be able to push a coloured string into another, but it loses the colour:

fn main() {
    let mut s = String::with_capacity(5);
    let msg = "blue";
    s.push_str(&msg.blue());

    println!("{}", msg.blue()); // works
    println!("{}", s); // no colour
}

Is this supported?

@Wilfred
Copy link
Author

Wilfred commented Dec 24, 2018

Ooh, this works:

    s.push_str(&msg.blue().to_string());

Perhaps mention this in the readme?

@mackwic
Copy link
Collaborator

mackwic commented Jan 4, 2019

Thank for the issue, it's not clear indeed.

Where would you like it to be ? In an example ? As a special case in the readme ?

@Wilfred
Copy link
Author

Wilfred commented Mar 9, 2019

I think mentioning in it the readme would be sufficient :)

@mfaerevaag
Copy link

+1 for docs. Looked through issues for exactly this 👍

@brundonsmith
Copy link

I just ran into the same issue, v2.0.0. Seems like it could be prevented at the type level?

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

4 participants