Write missing documentation in iced_native
This commit is contained in:
parent
13dd1ca0a8
commit
66f7d43dc9
8 changed files with 81 additions and 2 deletions
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue