iced_core/renderer/
null.rs
1use crate::alignment;
2use crate::image::{self, Image};
3use crate::renderer::{self, Renderer};
4use crate::svg;
5use crate::text::{self, Text};
6use crate::{
7 Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
8};
9
10impl Renderer for () {
11 fn start_layer(&mut self, _bounds: Rectangle) {}
12
13 fn end_layer(&mut self) {}
14
15 fn start_transformation(&mut self, _transformation: Transformation) {}
16
17 fn end_transformation(&mut self) {}
18
19 fn clear(&mut self) {}
20
21 fn fill_quad(
22 &mut self,
23 _quad: renderer::Quad,
24 _background: impl Into<Background>,
25 ) {
26 }
27}
28
29impl text::Renderer for () {
30 type Font = Font;
31 type Paragraph = ();
32 type Editor = ();
33
34 const ICON_FONT: Font = Font::DEFAULT;
35 const CHECKMARK_ICON: char = '0';
36 const ARROW_DOWN_ICON: char = '0';
37
38 fn default_font(&self) -> Self::Font {
39 Font::default()
40 }
41
42 fn default_size(&self) -> Pixels {
43 Pixels(16.0)
44 }
45
46 fn fill_paragraph(
47 &mut self,
48 _paragraph: &Self::Paragraph,
49 _position: Point,
50 _color: Color,
51 _clip_bounds: Rectangle,
52 ) {
53 }
54
55 fn fill_editor(
56 &mut self,
57 _editor: &Self::Editor,
58 _position: Point,
59 _color: Color,
60 _clip_bounds: Rectangle,
61 ) {
62 }
63
64 fn fill_text(
65 &mut self,
66 _paragraph: Text,
67 _position: Point,
68 _color: Color,
69 _clip_bounds: Rectangle,
70 ) {
71 }
72}
73
74impl text::Paragraph for () {
75 type Font = Font;
76
77 fn with_text(_text: Text<&str>) -> Self {}
78
79 fn with_spans<Link>(
80 _text: Text<&[text::Span<'_, Link, Self::Font>], Self::Font>,
81 ) -> Self {
82 }
83
84 fn resize(&mut self, _new_bounds: Size) {}
85
86 fn compare(&self, _text: Text<()>) -> text::Difference {
87 text::Difference::None
88 }
89
90 fn align_x(&self) -> text::Alignment {
91 text::Alignment::Default
92 }
93
94 fn align_y(&self) -> alignment::Vertical {
95 alignment::Vertical::Top
96 }
97
98 fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> {
99 None
100 }
101
102 fn min_bounds(&self) -> Size {
103 Size::ZERO
104 }
105
106 fn hit_test(&self, _point: Point) -> Option<text::Hit> {
107 None
108 }
109
110 fn hit_span(&self, _point: Point) -> Option<usize> {
111 None
112 }
113
114 fn span_bounds(&self, _index: usize) -> Vec<Rectangle> {
115 vec![]
116 }
117}
118
119impl text::Editor for () {
120 type Font = Font;
121
122 fn with_text(_text: &str) -> Self {}
123
124 fn is_empty(&self) -> bool {
125 true
126 }
127
128 fn cursor(&self) -> text::editor::Cursor {
129 text::editor::Cursor::Caret(Point::ORIGIN)
130 }
131
132 fn cursor_position(&self) -> (usize, usize) {
133 (0, 0)
134 }
135
136 fn selection(&self) -> Option<String> {
137 None
138 }
139
140 fn line(&self, _index: usize) -> Option<text::editor::Line<'_>> {
141 None
142 }
143
144 fn line_count(&self) -> usize {
145 0
146 }
147
148 fn perform(&mut self, _action: text::editor::Action) {}
149
150 fn bounds(&self) -> Size {
151 Size::ZERO
152 }
153
154 fn min_bounds(&self) -> Size {
155 Size::ZERO
156 }
157
158 fn update(
159 &mut self,
160 _new_bounds: Size,
161 _new_font: Self::Font,
162 _new_size: Pixels,
163 _new_line_height: text::LineHeight,
164 _new_wrapping: text::Wrapping,
165 _new_highlighter: &mut impl text::Highlighter,
166 ) {
167 }
168
169 fn highlight<H: text::Highlighter>(
170 &mut self,
171 _font: Self::Font,
172 _highlighter: &mut H,
173 _format_highlight: impl Fn(
174 &H::Highlight,
175 ) -> text::highlighter::Format<Self::Font>,
176 ) {
177 }
178}
179
180impl image::Renderer for () {
181 type Handle = image::Handle;
182
183 fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> {
184 Size::default()
185 }
186
187 fn draw_image(&mut self, _image: Image, _bounds: Rectangle) {}
188}
189
190impl svg::Renderer for () {
191 fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
192 Size::default()
193 }
194
195 fn draw_svg(&mut self, _svg: svg::Svg, _bounds: Rectangle) {}
196}