pub struct Compound<'s> {
pub src: &'s str,
pub bold: bool,
pub italic: bool,
pub code: bool,
pub strikeout: bool,
}
Expand description
a Compound is a part of a line with a consistent styling. It can be part of word, several words, some inline code, or even the whole line.
Fields
src: &'s str
bold: bool
italic: bool
code: bool
strikeout: bool
Implementations
sourceimpl<'s> Compound<'s>
impl<'s> Compound<'s>
sourcepub fn set_attributes_from(&mut self, other: &Compound<'_>)
pub fn set_attributes_from(&mut self, other: &Compound<'_>)
change the attributes by taking the values from the other compound, keeping the str
sourcepub fn sub(&self, r_start: usize, r_end: usize) -> Compound<'s>
pub fn sub(&self, r_start: usize, r_end: usize) -> Compound<'s>
return a sub part of the compound, with the same styling r_start is relative, that is 0 is the index of the first byte of this compound.
sourcepub fn sub_chars(&self, r_start: usize, r_end: usize) -> Compound<'s>
pub fn sub_chars(&self, r_start: usize, r_end: usize) -> Compound<'s>
return a sub part of the compound, with the same styling r_start is relative, that is 0 is the index of the first char of this compound.
The difference with sub
is that this method is unicode
aware and counts the chars instead of asking for the bytes
sourcepub fn tail(&self, r_start: usize) -> Compound<'s>
pub fn tail(&self, r_start: usize) -> Compound<'s>
return a sub part at end of the compound, with the same styling r_start is relative, that is if you give 0 you get a clone of this compound
sourcepub fn tail_chars(&self, r_start: usize) -> Compound<'s>
pub fn tail_chars(&self, r_start: usize) -> Compound<'s>
return a sub part at end of the compound, with the same styling r_start is relative, that is if you give 0 you get a clone of this compound
The difference with tail
is that this method is unicode
aware and counts the chars instead of asking for the bytes