pub struct TextOutput {
pub text: String,
pub marks: Vec<TextMark>,
pub styles: Vec<TextStyleMark>,
}Expand description
The value of the text backend’s output table flm.output.text
(TEXT_OUTPUT): the printed document, its position marks and its style
marks.
The emit stage (TextEmitStage) writes it
once per run, since the printed text is one document; the regions stage
and the final stage then publish its text as the text output’s artifact
set (flm.output.text.document). A program that writes the text to a
medium able to show what plain text cannot reads its style marks, as the
extension profile-tty does to paint the text for a terminal. A caller
that wants the characters and where each part of the document was printed
reads this table; a caller that wants the file reads the artifact set.
Fields§
§text: StringThe printed text: empty when nothing is printed, otherwise ending in exactly one newline.
marks: Vec<TextMark>The position marks, in the order the printer reaches their nodes in the printed text (a node’s mark before the marks of its descendants). The marks inside the cells of a table follow the table’s own marks, row by row and column by column, each over its text where the cell stands in the table, one mark per line of the cell for a node printed over several lines of it.
styles: Vec<TextStyleMark>The style marks, in the same order: the order the printer reaches
their nodes, a node’s mark before the marks inside it, and a table’s
TableBorder marks before the marks inside
its cells, one mark per line of a cell for a node styled over several
lines of it. See the module
documentation.
Implementations§
Source§impl TextOutput
impl TextOutput
Sourcepub fn slice(&self, mark: &TextMark) -> &str
pub fn slice(&self, mark: &TextMark) -> &str
Returns the printed text that mark covers.
§Panics
Panics if the byte range of mark lies outside this output’s text or
does not start and end on character boundaries. A mark taken from this
output’s own marks, with the output unchanged since
printing, never panics; a mark from another output, a mark built or
changed by hand, or an output whose text was changed after printing
can.
Sourcepub fn style_slice(&self, mark: &TextStyleMark) -> &str
pub fn style_slice(&self, mark: &TextStyleMark) -> &str
Returns the printed text that the style mark mark covers.
§Panics
Panics if the byte range of mark lies outside this output’s text or
does not start and end on character boundaries. A mark taken from this
output’s own styles, with the output unchanged since
printing, never panics; a mark from another output, a mark built or
changed by hand, or an output whose text was changed after printing
can.
Sourcepub fn marks_at(
&self,
addr: LoweredAddr,
) -> impl Iterator<Item = &TextMark> + '_
pub fn marks_at( &self, addr: LoweredAddr, ) -> impl Iterator<Item = &TextMark> + '_
Returns the marks that stand for the lowered node at addr, in the order
of marks. A node printed several times (for instance in a
tree placed twice) has several marks; a node for which nothing was
printed has none.
Trait Implementations§
Source§impl Clone for TextOutput
impl Clone for TextOutput
Source§impl Debug for TextOutput
impl Debug for TextOutput
Source§impl Default for TextOutput
impl Default for TextOutput
impl Eq for TextOutput
Source§impl PartialEq for TextOutput
impl PartialEq for TextOutput
Source§impl SingletonTable for TextOutput
impl SingletonTable for TextOutput
impl StructuralPartialEq for TextOutput
Source§impl Table for TextOutput
impl Table for TextOutput
Source§fn absorb(&mut self, piece: TextOutput)
fn absorb(&mut self, piece: TextOutput)
The table is written once per run, so it receives one table piece (the part of a table one stage invocation produced); a non-empty table piece replaces the value held so far.
Source§fn project(&self, _cx: &dyn ProjectCx) -> SerialValue
fn project(&self, _cx: &dyn ProjectCx) -> SerialValue
crate::dump) and tests. Read moreSource§fn piece_class(&self) -> PieceClass
fn piece_class(&self) -> PieceClass
Auto Trait Implementations§
impl Forget for TextOutput
impl Freeze for TextOutputwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<TextMark>: Freeze,
PhantomData<TextStyleMark>: Freeze,
impl Move for TextOutput
impl RefUnwindSafe for TextOutput
impl Send for TextOutputwhere
RawVecInner: Send,
impl Sync for TextOutputwhere
RawVecInner: Sync,
impl Unpin for TextOutput
impl UnsafeUnpin for TextOutputwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<TextMark>: UnsafeUnpin,
PhantomData<TextStyleMark>: UnsafeUnpin,
impl UnwindSafe for TextOutputwhere
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