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>) -> RenderString
pub fn subsequence(&self, range: Range<usize>) -> RenderString
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§fn clone(&self) -> RenderString
fn clone(&self) -> RenderString
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RenderString
impl Debug for RenderString
Source§impl Default for RenderString
impl Default for RenderString
Source§fn default() -> RenderString
fn default() -> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.