pub struct SourceTextBuilder { /* private fields */ }Expand description
Builds a SourceBlock’s normalized text while recording the inline
elements’ ranges in it (#911) — for a backend walking its source: text
nodes through push_text, a line break as
whitespace, an inline element between open_inline
and close_inline. Whitespace runs collapse to one
space, the text is trimmed, and a range never starts with the space
that separates it from what precedes.
Implementations§
Source§impl SourceTextBuilder
impl SourceTextBuilder
pub fn new() -> Self
Sourcepub fn open_inline(
&mut self,
tag: &str,
attrs: Vec<(String, String)>,
path: String,
)
pub fn open_inline( &mut self, tag: &str, attrs: Vec<(String, String)>, path: String, )
An inline element starts here.
Sourcepub fn close_inline(&mut self)
pub fn close_inline(&mut self)
The innermost open inline element ends here.
Sourcepub fn finish(self) -> (String, Vec<SourceInline>)
pub fn finish(self) -> (String, Vec<SourceInline>)
The text and the inline ranges; the text has no trailing space.
Trait Implementations§
Source§impl Debug for SourceTextBuilder
impl Debug for SourceTextBuilder
Auto Trait Implementations§
impl Forget for SourceTextBuilder
impl Freeze for SourceTextBuilderwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<SourceInline>: Freeze,
PhantomData<usize>: Freeze,
impl Move for SourceTextBuilder
impl RefUnwindSafe for SourceTextBuilder
impl Send for SourceTextBuilderwhere
RawVecInner: Send,
impl Sync for SourceTextBuilderwhere
RawVecInner: Sync,
impl Unpin for SourceTextBuilder
impl UnsafeUnpin for SourceTextBuilderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<SourceInline>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
impl UnwindSafe for SourceTextBuilderwhere
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
Mutably borrows from an owned value. Read more