pub struct StyleRun {
pub start: u32,
pub end: u32,
pub attributes: Vec<TextAttribute>,
}Expand description
A range of the text with a set of scalar attributes.
Fields§
§start: u32Inclusive UTF-8 byte start.
end: u32Exclusive UTF-8 byte end.
attributes: Vec<TextAttribute>The attributes applied to the range.
Implementations§
Source§impl StyleRun
impl StyleRun
Sourcepub fn new(start: u32, end: u32) -> Self
pub fn new(start: u32, end: u32) -> Self
Create an empty style run. Ranges are validated against the text by
AttributedString::new/AttributedString::push_run.
Sourcepub fn with(self, attribute: TextAttribute) -> Self
pub fn with(self, attribute: TextAttribute) -> Self
Add an attribute (builder style).
Sourcepub fn monospaced(self) -> Self
pub fn monospaced(self) -> Self
Mark the range monospaced.
Sourcepub fn strikethrough(self) -> Self
pub fn strikethrough(self) -> Self
Mark the range struck through.
Trait Implementations§
impl Eq for StyleRun
impl StructuralPartialEq for StyleRun
Auto Trait Implementations§
impl Forget for StyleRun
impl Freeze for StyleRun
impl Move for StyleRun
impl RefUnwindSafe for StyleRun
impl Send for StyleRun
impl Sync for StyleRun
impl Unpin for StyleRun
impl UnsafeUnpin for StyleRun
impl UnwindSafe for StyleRun
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
Mutably borrows from an owned value. Read more