gpui: Update Menu name to use SharedString type to support more types - #14791
Conversation
|
Sorry, I meant to submit a post on my fork first, then create a discussion to see if this suggestion is accepted, but I accidentally created it here. Let's discuss it here. |
|
I want to change the name type of Menu because I tried to add I18n support to Zed before, and used the rust-i18n crate that I implemented. The Here is a draft: Or sometime we use GPUI to create app, the Menu name may be a dynamic string that created in runtime, but by current design we can't store it to Menu, so I want to change the type of Menu name to Cow. |
Cow<'a, str> to support more types.Cow<'a, str> to support more types
c2a9722 to
b9c909a
Compare
| pub struct Menu<'a> { | ||
| /// The name of the menu | ||
| pub name: &'a str, | ||
| pub name: Cow<'a, str>, |
There was a problem hiding this comment.
Have we considered using a SharedString here?
That type is more commonly used in GPUI.
There was a problem hiding this comment.
SharedString is ok, it can handle same things.
Cow<'a, str> to support more typesSharedString type to support more types
maxdeviant
left a comment
There was a problem hiding this comment.
Thanks, this seems like a useful thing to have!
|
@maxdeviant And I have almost done the I18n support for Zed. Are there any plans to introduce this support at this stage? After the introduction, we need to keep using This may increase the workload of Zed development.
|
We haven't really discussed it internally yet, but my guess is that it's probably a ways off. |
|
Okay, I'll put it aside for now. |
…es (zed-industries#14791) Release Notes: - N/A


Release Notes: