Trait rust_sitter::Extract

source ·
pub trait Extract<Output> {
    type LeafFn: ?Sized;

    // Required method
    fn extract(
        node: Option<Node<'_>>,
        source: &[u8],
        last_idx: usize,
        leaf_fn: Option<&Self::LeafFn>
    ) -> Output;
}
Expand description

Defines the logic used to convert a node in a Tree Sitter tree to the corresponding Rust type.

Required Associated Types§

Required Methods§

source

fn extract( node: Option<Node<'_>>, source: &[u8], last_idx: usize, leaf_fn: Option<&Self::LeafFn> ) -> Output

Implementations on Foreign Types§

source§

impl<T: Extract<U>, U> Extract<Option<U>> for Option<T>

§

type LeafFn = <T as Extract<U>>::LeafFn

source§

fn extract( node: Option<Node<'_>>, source: &[u8], last_idx: usize, leaf_fn: Option<&Self::LeafFn> ) -> Option<U>

source§

impl<T: Extract<U>, U> Extract<Vec<U, Global>> for Vec<T>

§

type LeafFn = <T as Extract<U>>::LeafFn

source§

fn extract( node: Option<Node<'_>>, source: &[u8], last_idx: usize, leaf_fn: Option<&Self::LeafFn> ) -> Vec<U>

source§

impl Extract<()> for ()

§

type LeafFn = ()

source§

fn extract( _node: Option<Node<'_>>, _source: &[u8], _last_idx: usize, _leaf_fn: Option<&Self::LeafFn> )

source§

impl<T: Extract<U>, U> Extract<Box<U, Global>> for Box<T>

§

type LeafFn = <T as Extract<U>>::LeafFn

source§

fn extract( node: Option<Node<'_>>, source: &[u8], last_idx: usize, leaf_fn: Option<&Self::LeafFn> ) -> Box<U>

Implementors§

source§

impl<L> Extract<L> for WithLeaf<L>

§

type LeafFn = dyn Fn(&str) -> L + 'static

source§

impl<T: Extract<U>, U> Extract<Spanned<U>> for Spanned<T>

§

type LeafFn = <T as Extract<U>>::LeafFn