pub struct RenderString { /* private fields */ }Expand description
What rendering reads from an AnnotatedString: content, styles, and
link identity — never the link handlers, which live UI-side only.
Unlike AnnotatedString this is plain owned data (Send + Sync), so a
lowered scene that carries it can cross threads.
Built once and never changed, it hashes itself when built: renderers key
caches by RenderString::render_hash every frame.
Implementations§
Source§impl RenderString
impl RenderString
pub fn span_styles(&self) -> &[RangeStyle<SpanStyle>]
pub fn paragraph_styles(&self) -> &[RangeStyle<ParagraphStyle>]
pub fn string_annotations(&self) -> &[RangeStyle<StringAnnotation>]
Sourcepub fn links(&self) -> &[RangeStyle<LinkKey>]
pub fn links(&self) -> &[RangeStyle<LinkKey>]
Link ranges by identity (tag/url): enough to hash and to key caches, never enough to invoke a link.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn span_boundaries(&self) -> Vec<usize>
pub fn span_boundaries(&self) -> Vec<usize>
Returns a sorted list of unique byte indices where styles change.
Mirrors AnnotatedString::span_boundaries.
Sourcepub fn render_hash(&self) -> u64
pub fn render_hash(&self) -> u64
Mirrors AnnotatedString::render_hash: hashes the exact same fields
with the exact same formula, so a cache keyed by either stays keyed by
the same distinctions.
Sourcepub fn subsequence(&self, range: Range<usize>) -> Self
pub fn subsequence(&self, range: Range<usize>) -> Self
Returns a new RenderString containing a substring of the original
text and any styles that overlap with the new range, with indices
adjusted. Mirrors AnnotatedString::subsequence.