summaryrefslogtreecommitdiffstats
path: root/widget/src/container.rs
diff options
context:
space:
mode:
authorLibravatar Héctor <hector@hecrj.dev>2025-02-01 03:14:08 +0100
committerLibravatar GitHub <noreply@github.com>2025-02-01 03:14:08 +0100
commit91f94f3b6e62bf05fb82b3c3bd999eff7b3fd339 (patch)
treed9cb9cdf2a2c59e9b0ca01f5760033c994df730d /widget/src/container.rs
parent30ee9d024d00403f2fc0571946fa9ca398117e05 (diff)
parented0ffb59634424bb58540bdfdc4994d6665028ea (diff)
downloadiced-91f94f3b6e62bf05fb82b3c3bd999eff7b3fd339.tar.gz
iced-91f94f3b6e62bf05fb82b3c3bd999eff7b3fd339.tar.bz2
iced-91f94f3b6e62bf05fb82b3c3bd999eff7b3fd339.zip
Merge pull request #2776 from iced-rs/fix/markdown
Incremental `markdown` parsing and various fixes
Diffstat (limited to 'widget/src/container.rs')
-rw-r--r--widget/src/container.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/widget/src/container.rs b/widget/src/container.rs
index a411a7d2..852481f1 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -107,8 +107,8 @@ where
}
/// Sets the [`Id`] of the [`Container`].
- pub fn id(mut self, id: Id) -> Self {
- self.id = Some(id);
+ pub fn id(mut self, id: impl Into<Id>) -> Self {
+ self.id = Some(id.into());
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
/// [`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 {
target: widget::Id,
depth: usize,