diff options
author | 2022-08-05 05:15:41 +0200 | |
---|---|---|
committer | 2022-08-05 05:15:41 +0200 | |
commit | 66f7d43dc98df96c8b19cfd2aef6dcdd4187316c (patch) | |
tree | a252a9c81359d2f13401380538bd11c0ee6bbc37 /native/src/widget/scrollable.rs | |
parent | 13dd1ca0a83cc95eea52e2106da9dc1ee1f37958 (diff) | |
download | iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.gz iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.bz2 iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.zip |
Write missing documentation in `iced_native`
Diffstat (limited to 'native/src/widget/scrollable.rs')
-rw-r--r-- | native/src/widget/scrollable.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index b7a0b6ee..4ebb07a0 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -316,19 +316,26 @@ where } } +/// The identifier of a [`Scrollable`]. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Id(widget::Id); impl Id { + /// Creates a custom [`Id`]. pub fn new(id: impl Into<std::borrow::Cow<'static, str>>) -> Self { Self(widget::Id::new(id)) } + /// Creates a unique [`Id`]. + /// + /// This function produces a different [`Id`] every time it is called. pub fn unique() -> Self { Self(widget::Id::unique()) } } +/// Produces a [`Command`] that snaps the [`Scrollable`] with the given [`Id`] +/// to the provided `percentage`. pub fn snap_to<Message: 'static>(id: Id, percentage: f32) -> Command<Message> { Command::widget(operation::scrollable::snap_to(id.0, percentage)) } |