Improve naming in iced_selector crate

This commit is contained in:
Héctor Ramón Jiménez 2025-09-17 22:56:58 +02:00
parent 59e2687146
commit 299eb54d6f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
12 changed files with 235 additions and 219 deletions

View file

@ -8,9 +8,9 @@ static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
pub struct Id(Internal);
impl Id {
/// Creates a custom [`Id`].
pub fn new(id: impl Into<borrow::Cow<'static, str>>) -> Self {
Self(Internal::Custom(id.into()))
/// Creates a new [`Id`] from a static `str`.
pub const fn new(id: &'static str) -> Self {
Self(Internal::Custom(borrow::Cow::Borrowed(id)))
}
/// Creates a unique [`Id`].
@ -31,7 +31,7 @@ impl From<&'static str> for Id {
impl From<String> for Id {
fn from(value: String) -> Self {
Self::new(value)
Self(Internal::Custom(borrow::Cow::Owned(value)))
}
}