Try using closures for Container::style

`Box` should not allocate for zero-sized types; so
we should not be incurring much overhead. Just a
bit of indirection.
This commit is contained in:
Héctor Ramón Jiménez 2024-03-12 13:25:06 +01:00
parent 34317bba5d
commit 2088e5d661
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 43 additions and 39 deletions

View file

@ -58,7 +58,7 @@ pub fn container<'a, Message, Theme, Renderer>(
content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> Container<'a, Message, Theme, Renderer>
where
Theme: container::DefaultStyle,
Theme: container::DefaultStyle + 'a,
Renderer: core::Renderer,
{
Container::new(content)
@ -134,7 +134,7 @@ pub fn tooltip<'a, Message, Theme, Renderer>(
position: tooltip::Position,
) -> crate::Tooltip<'a, Message, Theme, Renderer>
where
Theme: container::DefaultStyle,
Theme: container::DefaultStyle + 'a,
Renderer: core::text::Renderer,
{
Tooltip::new(content, tooltip, position)