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) -> SpanBoundaries
pub fn span_boundaries(&self) -> SpanBoundaries
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.
Trait Implementations§
Source§impl Clone for RenderString
impl Clone for RenderString
Source§impl Debug for RenderString
impl Debug for RenderString
Source§impl Default for RenderString
impl Default for RenderString
Source§impl PartialEq for RenderString
impl PartialEq for RenderString
impl StructuralPartialEq for RenderString
Auto Trait Implementations§
impl Freeze for RenderString
impl RefUnwindSafe for RenderString
impl Send for RenderString
impl Sync for RenderString
impl Unpin for RenderString
impl UnsafeUnpin for RenderString
impl UnwindSafe for RenderString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more