Extract

Trait 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

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.

Implementations on Foreign Types§

Source§

impl Extract<()> for ()

Source§

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<Option<U>> for Option<T>

Source§

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<Box<U>> for Box<T>

Source§

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>

Source§

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

Source§

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>

Implementors§

Source§

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

Source§

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

Source§

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

Source§

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