Improve naming in iced_selector crate
This commit is contained in:
parent
59e2687146
commit
299eb54d6f
12 changed files with 235 additions and 219 deletions
|
|
@ -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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue