[−][src]Trait kas::text::format::FormattableTextDyn
Text, optionally with formatting data
This is an object-safe version of the FormattableText
trait (i.e.
dyn FormattableTextDyn
is a valid type).
This trait is auto-implemented for every implementation of FormattableText
.
The type &dyn FormattableTextDyn
implements FormattableText
.
Implement either this or (preferably) FormattableText
, not both.
Required methods
pub fn clone_boxed(&self) -> Box<dyn FormattableTextDyn + 'static, Global>
[src]
Produce a boxed clone of self
pub fn str_len(&self) -> usize
[src]
Length of text
pub fn as_str(&self) -> &str
[src]
Access whole text as contiguous str
pub fn font_tokens(&self, dpp: f32, pt_size: f32) -> OwningVecIter<FontToken>ⓘNotable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;
[src]
Notable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;
Construct an iterator over formatting items
It is expected that FontToken::start
of yielded items is strictly
increasing; if not, formatting may not be applied correctly.
The dpp
and pt_size
parameters are as in crate::Environment
.
For plain text this iterator will be empty.
pub fn effect_tokens(&self) -> &[Effect<()>]
[src]
Get the sequence of effect tokens
This method has some limitations: (1) it may only return a reference to
an existing sequence, (2) effect tokens cannot be generated dependent
on input state, and (3) it does not incorporate colour information. For
most uses it should still be sufficient, but for other cases it may be
preferable not to use this method (use a dummy implementation returning
&[]
and use inherent methods on the text object via Text::text
).
Trait Implementations
impl<'t> FormattableText for &'t (dyn FormattableTextDyn + 't)
[src]
pub fn str_len(&self) -> usize
[src]
pub fn as_str(&self) -> &str
[src]
pub fn font_tokens(&self, dpp: f32, pt_size: f32) -> OwningVecIter<FontToken>ⓘNotable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;
[src]
Notable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;
pub fn effect_tokens(&self) -> &[Effect<()>]
[src]
Implementors
impl<F> FormattableTextDyn for F where
F: 'static + FormattableText + Clone,
[src]
F: 'static + FormattableText + Clone,
pub fn clone_boxed(&self) -> Box<dyn FormattableTextDyn + 'static, Global>
[src]
pub fn str_len(&self) -> usize
[src]
pub fn as_str(&self) -> &str
[src]
pub fn font_tokens(&self, dpp: f32, pt_size: f32) -> OwningVecIter<FontToken>ⓘNotable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;
[src]
Notable traits for OwningVecIter<T>
impl<T> Iterator for OwningVecIter<T> where
T: Clone, type Item = T;