Struct cosmic_text::TextBufferLine
source · [−]pub struct TextBufferLine<'a> { /* private fields */ }Expand description
A line (or paragraph) of text that is shaped and laid out
Implementations
sourceimpl<'a> TextBufferLine<'a>
impl<'a> TextBufferLine<'a>
sourcepub fn new<T: Into<String>>(text: T, attrs_list: AttrsList<'a>) -> Self
pub fn new<T: Into<String>>(text: T, attrs_list: AttrsList<'a>) -> Self
Create a new line with the given text and attributes list Cached shaping and layout can be done using the Self::shape and Self::layout functions
sourcepub fn set_text<T: AsRef<str> + Into<String>>(&mut self, text: T) -> bool
pub fn set_text<T: AsRef<str> + Into<String>>(&mut self, text: T) -> bool
Set text
Will reset shape and layout if it differs from current text. Returns true if the line was reset
sourcepub fn attrs_list(&self) -> &AttrsList<'a>
pub fn attrs_list(&self) -> &AttrsList<'a>
Get attributes list
sourcepub fn set_attrs_list(&mut self, attrs_list: AttrsList<'a>) -> bool
pub fn set_attrs_list(&mut self, attrs_list: AttrsList<'a>) -> bool
Set attributes list
Will reset shape and layout if it differs from current attributes list. Returns true if the line was reset
sourcepub fn wrap_simple(&self) -> bool
pub fn wrap_simple(&self) -> bool
Get simple wrapping setting (wrap by characters only)
sourcepub fn set_wrap_simple(&mut self, wrap_simple: bool) -> bool
pub fn set_wrap_simple(&mut self, wrap_simple: bool) -> bool
Set simple wrapping setting (wrap by characters only)
Will reset shape and layout if it differs from current simple wrapping setting. Returns true if the line was reset
sourcepub fn shape(&mut self, font_system: &'a FontSystem<'a>) -> &ShapeLine
pub fn shape(&mut self, font_system: &'a FontSystem<'a>) -> &ShapeLine
Shape line, will cache results
sourcepub fn layout(
&mut self,
font_system: &'a FontSystem<'a>,
font_size: i32,
width: i32
) -> &[LayoutLine]
pub fn layout(
&mut self,
font_system: &'a FontSystem<'a>,
font_size: i32,
width: i32
) -> &[LayoutLine]
Layout line, will cache results
Auto Trait Implementations
impl<'a> RefUnwindSafe for TextBufferLine<'a>
impl<'a> Send for TextBufferLine<'a>
impl<'a> Sync for TextBufferLine<'a>
impl<'a> Unpin for TextBufferLine<'a>
impl<'a> UnwindSafe for TextBufferLine<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more