Skip to content

Use &str or String instead of &'static str in RenderConfig #95

Closed
@arturfast

Description

Is your feature request related to a problem? Please describe.
I'd like to customize my prompt prefix in the Text menu using the format! macro. This is not possible due to prompt_prefix being defined as a &'static str in RenderConfig. This is limiting because I can only pass string literals instead of formatted Strings or &str.

Describe the solution you'd like
I'd like to change the parameters of all the fields in RenderConfig, particulary prompt_prefix, to either String or &str. Alternatively I'd like to learn if there is any particular reason for it only accepting string literals.

Describe alternatives you've considered
I have tried various ways to convert a String to a &'static str but they all fail due to lifetimes. Here, here, and here are some of the stackoverflow questions regarding this. I also tried to concatenate string literals and pass the result, without success. Another method I tried was Box::leak(format!("{}", "Hello world").into_boxed_str()); , but it didn't work, and it's a dirty solution that leaks memory.

Additional context

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions