diff options
author | 2020-07-01 07:36:42 +0200 | |
---|---|---|
committer | 2020-07-01 07:36:42 +0200 | |
commit | 75464ad89422884e0718eb0429586a9d77f61c71 (patch) | |
tree | 5456ff6db21375d8b3814e6bb9c4c56649b135e3 /web/src/widget/image.rs | |
parent | d873c37e31fb052fb376caada6780137e176a6e7 (diff) | |
download | iced-75464ad89422884e0718eb0429586a9d77f61c71.tar.gz iced-75464ad89422884e0718eb0429586a9d77f61c71.tar.bz2 iced-75464ad89422884e0718eb0429586a9d77f61c71.zip |
Use `String::from_str_in` 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 => {} |