diff options
author | 2020-07-01 22:44:48 +0200 | |
---|---|---|
committer | 2020-07-01 22:44:48 +0200 | |
commit | 3f44d331d9c7afe14416130f54abd2b327a686bf (patch) | |
tree | fa68d060aabedda82c268a4cc06c501cbf1e626b /web/src/widget/image.rs | |
parent | 99a50d6b2ff2c54c276d3a142071bd77ac38e4f0 (diff) | |
parent | 75464ad89422884e0718eb0429586a9d77f61c71 (diff) | |
download | iced-3f44d331d9c7afe14416130f54abd2b327a686bf.tar.gz iced-3f44d331d9c7afe14416130f54abd2b327a686bf.tar.bz2 iced-3f44d331d9c7afe14416130f54abd2b327a686bf.zip |
Merge pull request #432 from hecrj/improvement/update-dodrio
Update `dodrio` in `iced_web`
Diffstat (limited to 'web/src/widget/image.rs')
-rw-r--r-- | web/src/widget/image.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/web/src/widget/image.rs b/web/src/widget/image.rs index a20bebea..a595c29a 100644 --- a/web/src/widget/image.rs +++ b/web/src/widget/image.rs @@ -78,14 +78,19 @@ impl<Message> Widget<Message> for Image { _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; + use dodrio::bumpalo::collections::String; - let src = bumpalo::format!(in bump, "{}", match self.handle.data.as_ref() { - Data::Path(path) => path.to_str().unwrap_or("") - }); - let alt = bumpalo::format!(in bump, "{}", self.alt).into_bump_str(); + let src = String::from_str_in( + match self.handle.data.as_ref() { + Data::Path(path) => path.to_str().unwrap_or(""), + }, + bump, + ) + .into_bump_str(); - let mut image = - img(bump).attr("src", src.into_bump_str()).attr("alt", alt); + let alt = String::from_str_in(&self.alt, bump).into_bump_str(); + + let mut image = img(bump).attr("src", src).attr("alt", alt); match self.width { Length::Shrink => {} |