From f943764a292837cbf262a4f29dc0021d808852d6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 24 Nov 2019 10:44:55 +0100 Subject: Fix `iced_native` widget examples --- native/src/widget/image.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'native/src/widget/image.rs') diff --git a/native/src/widget/image.rs b/native/src/widget/image.rs index c64f07b1..4c588c9d 100644 --- a/native/src/widget/image.rs +++ b/native/src/widget/image.rs @@ -10,19 +10,16 @@ use std::hash::Hash; /// /// ``` /// # use iced_native::Image; -/// +/// # /// let image = Image::new("resources/ferris.png"); /// ``` +/// +/// #[derive(Debug)] pub struct Image { - /// The image path - pub path: String, - - /// The width of the image - pub width: Length, - - /// The height of the image - pub height: Length, + path: String, + width: Length, + height: Length, } impl Image { @@ -99,7 +96,7 @@ where layout: Layout<'_>, _cursor_position: Point, ) -> Renderer::Output { - renderer.draw(&self, layout) + renderer.draw(&self.path, layout) } fn hash_layout(&self, state: &mut Hasher) { @@ -124,7 +121,7 @@ pub trait Renderer: crate::Renderer { /// Draws an [`Image`]. /// /// [`Image`]: struct.Image.html - fn draw(&mut self, image: &Image, layout: Layout<'_>) -> Self::Output; + fn draw(&mut self, path: &str, layout: Layout<'_>) -> Self::Output; } impl<'a, Message, Renderer> From for Element<'a, Message, Renderer> -- cgit