From 658fcf4d6f3ae84aae27dd13cfea5795c84f2313 Mon Sep 17 00:00:00 2001 From: grovesNL Date: Sun, 29 Jan 2023 21:29:20 -0330 Subject: [PATCH] Separate text area lifetimes --- src/lib.rs | 4 ++-- src/text_render.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9b7083b..6b6be54 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,9 +83,9 @@ impl Default for TextBounds { } /// 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. - pub buffer: &'a cosmic_text::Buffer<'a>, + pub buffer: &'a cosmic_text::Buffer<'b>, /// The left edge of the buffer. pub left: i32, /// The top edge of the buffer. diff --git a/src/text_render.rs b/src/text_render.rs index 0e9687c..95dc410 100644 --- a/src/text_render.rs +++ b/src/text_render.rs @@ -54,13 +54,13 @@ impl TextRenderer { } /// Prepares all of the provided text areas for rendering. - pub fn prepare<'a>( + pub fn prepare<'a, 'b: 'a>( &mut self, device: &Device, queue: &Queue, atlas: &mut TextAtlas, screen_resolution: Resolution, - text_areas: &[TextArea<'a>], + text_areas: &[TextArea<'a, 'b>], default_color: Color, cache: &mut SwashCache, ) -> Result<(), PrepareError> {