summaryrefslogtreecommitdiffstats
path: root/native/src/widget/id.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-05 05:15:41 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-05 05:15:41 +0200
commit66f7d43dc98df96c8b19cfd2aef6dcdd4187316c (patch)
treea252a9c81359d2f13401380538bd11c0ee6bbc37 /native/src/widget/id.rs
parent13dd1ca0a83cc95eea52e2106da9dc1ee1f37958 (diff)
downloadiced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.gz
iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.bz2
iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.zip
Write missing documentation in `iced_native`
Diffstat (limited to 'native/src/widget/id.rs')
-rw-r--r--native/src/widget/id.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/native/src/widget/id.rs b/native/src/widget/id.rs
index 4c0ab999..4b8fedf1 100644
--- a/native/src/widget/id.rs
+++ b/native/src/widget/id.rs
@@ -3,14 +3,19 @@ use std::sync::atomic::{self, AtomicUsize};
static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
+/// The identifier of a generic widget.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
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 unique [`Id`].
+ ///
+ /// This function produces a different [`Id`] every time it is called.
pub fn unique() -> Self {
let id = NEXT_ID.fetch_add(1, atomic::Ordering::Relaxed);