#[non_exhaustive]pub enum ImportSpec {
Query {
source: Cow<'static, str>,
kind_map: fn(&str) -> ImportKind,
},
Custom(fn(&str, &Tree) -> Vec<RawImport>),
}Expand description
Import-extraction strategy for a language. Stage B supplies the extractors; the shape is fixed here so registering one later is not a public-API break.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Query
Extract imports with a tree-sitter query whose capture names map to import kinds.
Fields
§
kind_map: fn(&str) -> ImportKindMaps a query capture name to the import kind it represents.
Custom(fn(&str, &Tree) -> Vec<RawImport>)
Extract imports with a language-specific syntax-tree walker, for languages a flat query cannot express (Rust use-trees).
Auto Trait Implementations§
impl Freeze for ImportSpec
impl RefUnwindSafe for ImportSpec
impl Send for ImportSpec
impl Sync for ImportSpec
impl Unpin for ImportSpec
impl UnsafeUnpin for ImportSpec
impl UnwindSafe for ImportSpec
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