Use ouroboros in FontSystem to avoid lifetime bound

Perhaps not quite what ouroboros is expected to be used for, but it's
not too bad, and avoiding the lifetime bound can be a huge help.
This commit is contained in:
Ian Douglas Scott 2022-11-02 19:25:18 -07:00 committed by Jeremy Soller
parent ac354c3a2a
commit 0d3fb1dd9d
8 changed files with 85 additions and 62 deletions

View file

@ -139,7 +139,7 @@ impl fmt::Display for Metrics {
/// A buffer of text that is shaped and laid out
pub struct Buffer<'a> {
font_system: &'a FontSystem<'a>,
font_system: &'a FontSystem,
/// Lines (or paragraphs) of text in the buffer
pub lines: Vec<BufferLine>,
metrics: Metrics,
@ -153,7 +153,7 @@ pub struct Buffer<'a> {
impl<'a> Buffer<'a> {
/// Create a new [Buffer] with the provided [FontSystem] and [Metrics]
pub fn new(
font_system: &'a FontSystem<'a>,
font_system: &'a FontSystem,
metrics: Metrics,
) -> Self {
let mut buffer = Self {