pub(super) struct Text<'a>(&'a str);Expand description
The text of a Markdown document.
Tuple Fields§
§0: &'a strImplementations§
Source§impl<'a> Text<'a>
impl<'a> Text<'a>
pub(super) const fn new(text: &'a str) -> Self
pub(super) const fn len(self) -> usize
Sourcepub(super) fn slice<I: SliceIndex<str>>(
self,
range: I,
) -> Result<&'a I::Output, InternalError>
pub(super) fn slice<I: SliceIndex<str>>( self, range: I, ) -> Result<&'a I::Output, InternalError>
Slice the text fallibly instead of indexing it directly, since the offsets spliced into a Markdown document come from a separate parse pass and should never land outside the string or across a UTF-8 boundary, but must not panic if that invariant is ever violated.
fn lines(self) -> LineIndex
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Text<'a>
impl<'a> RefUnwindSafe for Text<'a>
impl<'a> Send for Text<'a>
impl<'a> Sync for Text<'a>
impl<'a> Unpin for Text<'a>
impl<'a> UnsafeUnpin for Text<'a>
impl<'a> UnwindSafe for Text<'a>
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