diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs index 81bea0c506..8adc368c69 100644 --- a/widget/src/markdown.rs +++ b/widget/src/markdown.rs @@ -57,7 +57,7 @@ use crate::core::{ use crate::{column, container, rich_text, row, scrollable, span, text}; use std::cell::{Cell, RefCell}; -use std::rc::Rc; +use std::sync::Arc; pub use core::text::Highlight; pub use pulldown_cmark::HeadingLevel; @@ -88,7 +88,7 @@ pub enum Item { pub struct Text { spans: Vec, last_style: Cell>, - last_styled_spans: RefCell]>>, + last_styled_spans: RefCell]>>, } impl Text { @@ -104,7 +104,7 @@ impl Text { /// /// This method performs caching for you. It will only reallocate if the [`Style`] /// provided changes. - pub fn spans(&self, style: Style) -> Rc<[text::Span<'static, Url>]> { + pub fn spans(&self, style: Style) -> Arc<[text::Span<'static, Url>]> { if Some(style) != self.last_style.get() { *self.last_styled_spans.borrow_mut() = self.spans.iter().map(|span| span.view(&style)).collect();