diff options
Diffstat (limited to '')
| -rw-r--r-- | core/src/element.rs | 4 | ||||
| -rw-r--r-- | core/src/renderer.rs | 4 | ||||
| -rw-r--r-- | core/src/renderer/null.rs | 34 | ||||
| -rw-r--r-- | core/src/size.rs | 2 | 
4 files changed, 22 insertions, 22 deletions
diff --git a/core/src/element.rs b/core/src/element.rs index 989eaa3b..7d918a2e 100644 --- a/core/src/element.rs +++ b/core/src/element.rs @@ -95,7 +95,7 @@ impl<'a, Message, Theme, Renderer> Element<'a, Message, Theme, Renderer> {      ///      /// ```no_run      /// # mod iced { -    /// #     pub type Element<'a, Message> = iced_core::Element<'a, Message, iced_core::Theme, iced_core::renderer::Null>; +    /// #     pub type Element<'a, Message> = iced_core::Element<'a, Message, iced_core::Theme, ()>;      /// #      /// #     pub mod widget {      /// #         pub fn row<'a, Message>(iter: impl IntoIterator<Item = super::Element<'a, Message>>) -> super::Element<'a, Message> { @@ -109,7 +109,7 @@ impl<'a, Message, Theme, Renderer> Element<'a, Message, Theme, Renderer> {      /// #     pub enum Message {}      /// #     pub struct Counter;      /// # -    /// #     pub type Element<'a, Message> = iced_core::Element<'a, Message, iced_core::Theme, iced_core::renderer::Null>; +    /// #     pub type Element<'a, Message> = iced_core::Element<'a, Message, iced_core::Theme, ()>;      /// #      /// #     impl Counter {      /// #         pub fn view(&self) -> Element<Message> { diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 406b33f3..dfedcd45 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -1,10 +1,6 @@  //! Write your own renderer. -#[cfg(debug_assertions)]  mod null; -#[cfg(debug_assertions)] -pub use null::Null; -  use crate::{      Background, Border, Color, Rectangle, Shadow, Size, Transformation, Vector,  }; diff --git a/core/src/renderer/null.rs b/core/src/renderer/null.rs index 0d7b7c14..af7dc15f 100644 --- a/core/src/renderer/null.rs +++ b/core/src/renderer/null.rs @@ -1,4 +1,5 @@  use crate::alignment; +use crate::image;  use crate::renderer::{self, Renderer};  use crate::text::{self, Text};  use crate::{ @@ -7,20 +8,7 @@ use crate::{  use std::borrow::Cow; -/// A renderer that does nothing. -/// -/// It can be useful if you are writing tests! -#[derive(Debug, Clone, Copy, Default)] -pub struct Null; - -impl Null { -    /// Creates a new [`Null`] renderer. -    pub fn new() -> Null { -        Null -    } -} - -impl Renderer for Null { +impl Renderer for () {      fn start_layer(&mut self) {}      fn end_layer(&mut self, _bounds: Rectangle) {} @@ -39,7 +27,7 @@ impl Renderer for Null {      }  } -impl text::Renderer for Null { +impl text::Renderer for () {      type Font = Font;      type Paragraph = ();      type Editor = (); @@ -173,3 +161,19 @@ impl text::Editor for () {      ) {      }  } + +impl image::Renderer for () { +    type Handle = (); + +    fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> { +        Size::default() +    } + +    fn draw_image( +        &mut self, +        _handle: Self::Handle, +        _filter_method: image::FilterMethod, +        _bounds: Rectangle, +    ) { +    } +} diff --git a/core/src/size.rs b/core/src/size.rs index 267fc90e..55db759d 100644 --- a/core/src/size.rs +++ b/core/src/size.rs @@ -1,7 +1,7 @@  use crate::Vector;  /// An amount of space in 2 dimensions. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]  pub struct Size<T = f32> {      /// The width.      pub width: T,  | 
