pub struct TextStyleMark {
pub style: TextStyle,
pub bytes: Range<usize>,
pub start: LineCol,
pub end: LineCol,
}Expand description
A style mark of the text output: a range of TextOutput::text whose
content carries a property that plain text cannot show (TextStyle).
It holds the style, and the byte range and the line and column range of
the content characters it covers, counted as for a position mark
(TextMark). TextOutput::styles holds one per styled node printed,
or one per line of a table’s cell for a node styled over several lines of
it, and TextOutput::style_slice returns the text it covers. Unlike
position marks, style marks are recorded inside pieces too (the title, the
list of notes), so that a program painting the text sees every styled
range.
§Examples
use flm_core::layout::LineCol;
use flm_core::stdlib::backends::text::{TextOutput, TextStyle, TextStyleMark};
let output = TextOutput {
text: String::from("A bold word.\n"),
marks: Vec::new(),
styles: vec![TextStyleMark {
style: TextStyle::Bold,
bytes: 2..6,
start: LineCol { line: 0, col: 2 },
end: LineCol { line: 0, col: 6 },
}],
};
assert_eq!(output.style_slice(&output.styles[0]), "bold");Fields§
§style: TextStyleThe property the covered content carries.
bytes: Range<usize>The byte range of TextOutput::text that holds the styled content
characters.
start: LineColThe line and column of the first styled content character, counted from 0.
end: LineColThe line and column just after the last styled content character.
Trait Implementations§
Source§impl Clone for TextStyleMark
impl Clone for TextStyleMark
Source§impl Debug for TextStyleMark
impl Debug for TextStyleMark
impl Eq for TextStyleMark
Source§impl PartialEq for TextStyleMark
impl PartialEq for TextStyleMark
impl StructuralPartialEq for TextStyleMark
Auto Trait Implementations§
impl Forget for TextStyleMark
impl Freeze for TextStyleMark
impl Move for TextStyleMark
impl RefUnwindSafe for TextStyleMark
impl Send for TextStyleMarkwhere
RawVecInner: Send,
impl Sync for TextStyleMarkwhere
RawVecInner: Sync,
impl Unpin for TextStyleMark
impl UnsafeUnpin for TextStyleMark
impl UnwindSafe for TextStyleMarkwhere
RawVecInner: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more