pub trait Doc: Clone {
type Source: Content;
type Lang: Language;
// Required methods
fn get_lang(&self) -> &Self::Lang;
fn get_source(&self) -> &Self::Source;
fn get_source_mut(&mut self) -> &mut Self::Source;
fn from_str(src: &str, lang: Self::Lang) -> Self;
// Provided method
fn parse(&self, old_tree: Option<&Tree>) -> Result<Tree, TSParseError> { ... }
}
TODO: are we paying too much to support str as Pattern/Replacer??
this method converts string to Doc, so that we can support using
string as replacer/searcher. Natively.