Separate text area lifetimes

This commit is contained in:
grovesNL 2023-01-29 21:29:20 -03:30 committed by Josh Groves
parent 07b04f511a
commit 658fcf4d6f
2 changed files with 4 additions and 4 deletions

View file

@ -83,9 +83,9 @@ impl Default for TextBounds {
} }
/// A text area containing text to be rendered along with its overflow behavior. /// A text area containing text to be rendered along with its overflow behavior.
pub struct TextArea<'a> { pub struct TextArea<'a, 'b: 'a> {
/// The buffer containing the text to be rendered. /// The buffer containing the text to be rendered.
pub buffer: &'a cosmic_text::Buffer<'a>, pub buffer: &'a cosmic_text::Buffer<'b>,
/// The left edge of the buffer. /// The left edge of the buffer.
pub left: i32, pub left: i32,
/// The top edge of the buffer. /// The top edge of the buffer.

View file

@ -54,13 +54,13 @@ impl TextRenderer {
} }
/// Prepares all of the provided text areas for rendering. /// Prepares all of the provided text areas for rendering.
pub fn prepare<'a>( pub fn prepare<'a, 'b: 'a>(
&mut self, &mut self,
device: &Device, device: &Device,
queue: &Queue, queue: &Queue,
atlas: &mut TextAtlas, atlas: &mut TextAtlas,
screen_resolution: Resolution, screen_resolution: Resolution,
text_areas: &[TextArea<'a>], text_areas: &[TextArea<'a, 'b>],
default_color: Color, default_color: Color,
cache: &mut SwashCache, cache: &mut SwashCache,
) -> Result<(), PrepareError> { ) -> Result<(), PrepareError> {