Use generic Content in Text to avoid reallocation in fill_text
This commit is contained in:
parent
c7a4fad4a2
commit
6216c513d5
10 changed files with 22 additions and 20 deletions
|
|
@ -16,9 +16,9 @@ use std::hash::{Hash, Hasher};
|
|||
|
||||
/// A paragraph.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Text<'a, Font> {
|
||||
pub struct Text<Content = String, Font = crate::Font> {
|
||||
/// The content of the paragraph.
|
||||
pub content: &'a str,
|
||||
pub content: Content,
|
||||
|
||||
/// The bounds of the paragraph.
|
||||
pub bounds: Size,
|
||||
|
|
@ -219,7 +219,7 @@ pub trait Renderer: crate::Renderer {
|
|||
/// [`Color`].
|
||||
fn fill_text(
|
||||
&mut self,
|
||||
text: Text<'_, Self::Font>,
|
||||
text: Text<String, Self::Font>,
|
||||
position: Point,
|
||||
color: Color,
|
||||
clip_bounds: Rectangle,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue