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

Provide alternative to slint::format!("{}", something_implementing_display) (Rust) #6625

Open
Enyium opened this issue Oct 22, 2024 · 0 comments
Labels
a:language-rust Rust API and codegen (mO,mS) enhancement New feature or request good first issue Good for newcomers

Comments

@Enyium
Copy link
Contributor

Enyium commented Oct 22, 2024

It would be nice to have a function that easily transforms something implementing Display to a SharedString without having to use a format string, like the common .to_string():

pub trait ToString {
    fn to_string(&self) -> String;
}

impl<T> ToString for T
where
    T: Display + ?Sized,

How about you provide the following equivalent:

pub trait ToSharedString {
    fn to_shared_string(&self) -> SharedString;
}

impl<T> ToSharedString for T
where
    T: Display + ?Sized,
@ogoffart ogoffart added enhancement New feature or request good first issue Good for newcomers a:language-rust Rust API and codegen (mO,mS) labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-rust Rust API and codegen (mO,mS) enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants