From 66f7d43dc98df96c8b19cfd2aef6dcdd4187316c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Aug 2022 05:15:41 +0200 Subject: Write missing documentation in `iced_native` --- native/src/widget/id.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'native/src/widget/id.rs') 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>) -> 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); -- cgit