Replace Raw in core::text::Renderer with a new Renderer trait

This commit is contained in:
Héctor Ramón Jiménez 2025-11-26 00:41:05 +01:00
parent 4ea0db665f
commit a0b409ed7e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
6 changed files with 33 additions and 29 deletions

View file

@ -8,6 +8,7 @@ use crate::core::{
};
use crate::graphics::compositor;
use crate::graphics::mesh;
use crate::graphics::text;
use crate::graphics::{self, Shell};
use std::borrow::Cow;
@ -88,13 +89,11 @@ where
Font = A::Font,
Paragraph = A::Paragraph,
Editor = A::Editor,
Raw = A::Raw,
>,
{
type Font = A::Font;
type Paragraph = A::Paragraph;
type Editor = A::Editor;
type Raw = A::Raw;
const ICON_FONT: Self::Font = A::ICON_FONT;
const CHECKMARK_ICON: char = A::CHECKMARK_ICON;
@ -137,10 +136,6 @@ where
);
}
fn fill_raw(&mut self, raw: Self::Raw) {
delegate!(self, renderer, renderer.fill_raw(raw));
}
fn fill_text(
&mut self,
text: core::Text<String, Self::Font>,
@ -156,6 +151,16 @@ where
}
}
impl<A, B> text::Renderer for Renderer<A, B>
where
A: text::Renderer,
B: text::Renderer,
{
fn fill_raw(&mut self, raw: text::Raw) {
delegate!(self, renderer, renderer.fill_raw(raw));
}
}
impl<A, B> image::Renderer for Renderer<A, B>
where
A: image::Renderer,