summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-21 22:27:49 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-21 22:27:49 +0200
commit6d1ecb79e38ece36420278494d1a5b2b3062161b (patch)
tree8c59bd3df00ef5b04848c486e3f9aed68c2b0ab3 /widget
parent24150effad51d6962d00be0950fef4cbac8e6ec5 (diff)
downloadiced-6d1ecb79e38ece36420278494d1a5b2b3062161b.tar.gz
iced-6d1ecb79e38ece36420278494d1a5b2b3062161b.tar.bz2
iced-6d1ecb79e38ece36420278494d1a5b2b3062161b.zip
Replace `Rc` with `Arc` for `markdown` caching
Diffstat (limited to 'widget')
-rw-r--r--widget/src/markdown.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs
index 81bea0c5..8adc368c 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<Span>,
last_style: Cell<Option<Style>>,
- last_styled_spans: RefCell<Rc<[text::Span<'static, Url>]>>,
+ last_styled_spans: RefCell<Arc<[text::Span<'static, Url>]>>,
}
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();