Trait Doc

Source
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 clone_with_lang(&self, lang: Self::Lang) -> Self;
    fn from_str(src: &str, lang: Self::Lang) -> Self;

    // Provided method
    fn parse(&self, old_tree: Option<&Tree>) -> Result<Tree, TSParseError> { ... }
}

Required Associated Types§

Required Methods§

Source

fn get_lang(&self) -> &Self::Lang

Source

fn get_source(&self) -> &Self::Source

Source

fn get_source_mut(&mut self) -> &mut Self::Source

Source

fn clone_with_lang(&self, lang: Self::Lang) -> Self

Source

fn from_str(src: &str, lang: Self::Lang) -> Self

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.

Provided Methods§

Source

fn parse(&self, old_tree: Option<&Tree>) -> Result<Tree, TSParseError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§