iced_native/renderer/
null.rs1use crate::renderer::{self, Renderer};
2use crate::text::{self, Text};
3use crate::{Background, Font, Point, Rectangle, Size, Theme, Vector};
4
5#[derive(Debug, Clone, Copy, Default)]
9pub struct Null;
10
11impl Null {
12 pub fn new() -> Null {
14 Null
15 }
16}
17
18impl Renderer for Null {
19 type Theme = Theme;
20
21 fn with_layer(&mut self, _bounds: Rectangle, _f: impl FnOnce(&mut Self)) {}
22
23 fn with_translation(
24 &mut self,
25 _translation: Vector,
26 _f: impl FnOnce(&mut Self),
27 ) {
28 }
29
30 fn clear(&mut self) {}
31
32 fn fill_quad(
33 &mut self,
34 _quad: renderer::Quad,
35 _background: impl Into<Background>,
36 ) {
37 }
38}
39
40impl text::Renderer for Null {
41 type Font = Font;
42
43 const ICON_FONT: Font = Font::Default;
44 const CHECKMARK_ICON: char = '0';
45 const ARROW_DOWN_ICON: char = '0';
46
47 fn default_size(&self) -> f32 {
48 20.0
49 }
50
51 fn measure(
52 &self,
53 _content: &str,
54 _size: f32,
55 _font: Font,
56 _bounds: Size,
57 ) -> (f32, f32) {
58 (0.0, 20.0)
59 }
60
61 fn hit_test(
62 &self,
63 _contents: &str,
64 _size: f32,
65 _font: Self::Font,
66 _bounds: Size,
67 _point: Point,
68 _nearest_only: bool,
69 ) -> Option<text::Hit> {
70 None
71 }
72
73 fn fill_text(&mut self, _text: Text<'_, Self::Font>) {}
74}