Skip to main content

LangSpec

Trait LangSpec 

Source
pub trait LangSpec: Sync {
Show 17 methods // Required methods fn receiver(&self) -> &'static str; fn def( &self, node: Node<'_>, src: &[u8], in_class: bool, ) -> Option<(SymbolKind, String)>; fn variable(&self, node: Node<'_>, src: &[u8]) -> Option<String>; fn import(&self, node: Node<'_>, src: &[u8]) -> Option<Vec<Import>>; fn reference( &self, node: Node<'_>, src: &[u8], ) -> Option<(RefKind, Vec<String>)>; fn assignment( &self, node: Node<'_>, src: &[u8], ) -> Option<(Target, TypeSource)>; fn bases(&self, def: Node<'_>, src: &[u8]) -> Vec<(RefKind, Vec<String>)>; fn returns(&self, def: Node<'_>, src: &[u8]) -> Option<Vec<String>>; fn params( &self, def: Node<'_>, src: &[u8], ) -> Vec<(String, Vec<String>, bool)>; // Provided methods fn owned_bases( &self, _node: Node<'_>, _src: &[u8], ) -> Option<(String, RefKind, Vec<String>)> { ... } fn contract(&self, _node: Node<'_>, _src: &[u8]) -> Option<RawContract> { ... } fn contracts(&self, node: Node<'_>, src: &[u8]) -> Vec<RawContract> { ... } fn param_names(&self, _def: Node<'_>, _src: &[u8]) -> Vec<String> { ... } fn call(&self, _node: Node<'_>, _src: &[u8]) -> Option<(Vec<String>, Args)> { ... } fn value(&self, _node: Node<'_>, _src: &[u8]) -> Option<(String, ValueExpr)> { ... } fn package(&self, _root: Node<'_>, _src: &[u8]) -> Option<String> { ... } fn owner(&self, _def: Node<'_>, _src: &[u8]) -> Option<String> { ... }
}

Required Methods§

Source

fn receiver(&self) -> &'static str

Receiver name inside methods (self, this).

Source

fn def( &self, node: Node<'_>, src: &[u8], in_class: bool, ) -> Option<(SymbolKind, String)>

A definition node: its kind and name. in_class is true directly inside a class body.

Source

fn variable(&self, node: Node<'_>, src: &[u8]) -> Option<String>

A module-level variable binding’s name (only asked at module scope).

Source

fn import(&self, node: Node<'_>, src: &[u8]) -> Option<Vec<Import>>

Some for an import/re-export statement (not descended into), possibly empty.

Source

fn reference( &self, node: Node<'_>, src: &[u8], ) -> Option<(RefKind, Vec<String>)>

A call or construction and the dotted path of its callee.

Source

fn assignment(&self, node: Node<'_>, src: &[u8]) -> Option<(Target, TypeSource)>

An assignment (or field declaration) whose target type can be inferred.

Source

fn bases(&self, def: Node<'_>, src: &[u8]) -> Vec<(RefKind, Vec<String>)>

Base classes / implemented interfaces of a class-like definition.

Source

fn returns(&self, def: Node<'_>, src: &[u8]) -> Option<Vec<String>>

Declared return type of a callable.

Source

fn params(&self, def: Node<'_>, src: &[u8]) -> Vec<(String, Vec<String>, bool)>

Typed parameters of a callable; true marks constructor parameter properties (TS).

Provided Methods§

Source

fn owned_bases( &self, _node: Node<'_>, _src: &[u8], ) -> Option<(String, RefKind, Vec<String>)>

A base declared apart from the type (Rust impl Trait for Type): (type name, kind, base).

Source

fn contract(&self, _node: Node<'_>, _src: &[u8]) -> Option<RawContract>

Contract syntax at this node (routes, client construction, service operations).

Source

fn contracts(&self, node: Node<'_>, src: &[u8]) -> Vec<RawContract>

Every contract at this node (a router line can register several verbs).

Source

fn param_names(&self, _def: Node<'_>, _src: &[u8]) -> Vec<String>

Parameter names of a callable in order, receiver excluded.

Source

fn call(&self, _node: Node<'_>, _src: &[u8]) -> Option<(Vec<String>, Args)>

A call with at least one statically readable argument: callee path and arguments.

Source

fn value(&self, _node: Node<'_>, _src: &[u8]) -> Option<(String, ValueExpr)>

name = <statically known value> at module or class level.

Source

fn package(&self, _root: Node<'_>, _src: &[u8]) -> Option<String>

The package a file declares (JVM); None derives it from the path instead.

Source

fn owner(&self, _def: Node<'_>, _src: &[u8]) -> Option<String>

The type a definition declared outside it belongs to (Go method receivers).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§