pub struct Document { /* private fields */ }Expand description
One text, its language, and its current tree.
Implementations§
Source§impl Document
impl Document
Sourcepub fn new(tag: &str, source: impl Into<String>) -> Option<Self>
pub fn new(tag: &str, source: impl Into<String>) -> Option<Self>
Parse source as the language tag names.
pub fn with_lang(lang: &'static Lang, source: impl Into<String>) -> Option<Self>
Sourcepub fn edit(
&mut self,
range: Range<usize>,
new_end: usize,
source: &str,
) -> Vec<Range<usize>>
pub fn edit( &mut self, range: Range<usize>, new_end: usize, source: &str, ) -> Vec<Range<usize>>
range of the text held became the new_end - range.start bytes of
source that start at range.start, and source is the whole text
now. Reparses from the old tree and answers the byte ranges of source
whose spans may have changed.
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Document
impl Move for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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