From 75464ad89422884e0718eb0429586a9d77f61c71 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Jul 2020 07:36:42 +0200 Subject: Use `String::from_str_in` in `iced_web` --- web/src/widget/image.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'web/src/widget/image.rs') 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 Widget 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 => {} -- cgit