Use Into<Id> for container::Id arguments
This commit is contained in:
parent
aa0f0e73aa
commit
ea8696eac2
1 changed files with 11 additions and 3 deletions
|
|
@ -107,8 +107,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the [`Id`] of the [`Container`].
|
/// Sets the [`Id`] of the [`Container`].
|
||||||
pub fn id(mut self, id: Id) -> Self {
|
pub fn id(mut self, id: impl Into<Id>) -> Self {
|
||||||
self.id = Some(id);
|
self.id = Some(id.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,9 +480,17 @@ impl From<Id> for widget::Id {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&'static str> for Id {
|
||||||
|
fn from(value: &'static str) -> Self {
|
||||||
|
Id::new(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that queries the visible screen bounds of the
|
/// Produces a [`Task`] that queries the visible screen bounds of the
|
||||||
/// [`Container`] with the given [`Id`].
|
/// [`Container`] with the given [`Id`].
|
||||||
pub fn visible_bounds(id: Id) -> Task<Option<Rectangle>> {
|
pub fn visible_bounds(id: impl Into<Id>) -> Task<Option<Rectangle>> {
|
||||||
|
let id = id.into();
|
||||||
|
|
||||||
struct VisibleBounds {
|
struct VisibleBounds {
|
||||||
target: widget::Id,
|
target: widget::Id,
|
||||||
depth: usize,
|
depth: usize,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue