pub struct Index {
pub roots: DashMap<PathBuf, HashMap<Symbol<Module>, ImStr>>,
pub records: RecordIndex,
pub templates: TemplateIndex,
pub models: ModelIndex,
pub components: ComponentIndex,
pub widgets: DashMap<ImStr, MinLoc>,
pub actions: DashMap<ImStr, MinLoc>,
}
Fields§
§roots: DashMap<PathBuf, HashMap<Symbol<Module>, ImStr>>
root -> module key -> module’s relpath to root
records: RecordIndex
§templates: TemplateIndex
§models: ModelIndex
§components: ComponentIndex
§widgets: DashMap<ImStr, MinLoc>
§actions: DashMap<ImStr, MinLoc>
Implementations§
Source§impl Index
impl Index
pub fn delete_marked_entries(&self)
pub async fn add_root( &self, root: &Path, client: Option<Client>, tsconfig: bool, ) -> Result<Option<AddRootResults>>
pub fn remove_root(&self, root: &Path)
Sourcepub fn module_of_path(&self, path: &Path) -> Option<ModuleName>
pub fn module_of_path(&self, path: &Path) -> Option<ModuleName>
Has complexity of O(len(self.roots))
Source§impl Index
impl Index
pub fn model_of_range( &self, node: Node<'_>, range: ByteRange, contents: &[u8], ) -> Option<ModelName>
pub fn type_of_range( &self, node: Node<'_>, range: ByteRange, contents: &[u8], ) -> Option<(Type, Scope)>
Sourcepub fn build_scope(
&self,
scope: &mut Scope,
node: Node<'_>,
offset: usize,
contents: &[u8],
) -> ScopeControlFlow
pub fn build_scope( &self, scope: &mut Scope, node: Node<'_>, offset: usize, contents: &[u8], ) -> ScopeControlFlow
Builds the scope up to offset
, in bytes.
§About ScopeControlFlow
This is one of the rare occasions where ControlFlow is used. It is similar to Result in that the try-operator (?) can be used to end iteration on a ControlFlow::Break. Otherwise, ControlFlow::Continue has a continuation value that must be passed up the chain, since it indicates whether Scope::enter was called.
Sourcepub fn type_of(
&self,
node: Node<'_>,
scope: &Scope,
contents: &[u8],
) -> Option<Type>
pub fn type_of( &self, node: Node<'_>, scope: &Scope, contents: &[u8], ) -> Option<Type>
Type::Value is not returned by this method.
pub fn type_of_attribute( &self, type_: &Type, attr: &[u8], scope: &Scope, ) -> Option<Type>
pub fn has_attribute(&self, type_: &Type, attr: &[u8], scope: &Scope) -> bool
Sourcepub fn try_resolve_model(
&self,
type_: &Type,
scope: &Scope,
) -> Option<ModelName>
pub fn try_resolve_model( &self, type_: &Type, scope: &Scope, ) -> Option<ModelName>
Call this method if it’s unclear whether type_
is a Type::Model
and you just want the model’s name.
Sourcepub fn walk_scope<T>(
node: Node<'_>,
scope: Option<Scope>,
step: impl FnMut(&mut Scope, Node<'_>) -> ControlFlow<Option<T>, bool>,
) -> (Scope, Option<T>)
pub fn walk_scope<T>( node: Node<'_>, scope: Option<Scope>, step: impl FnMut(&mut Scope, Node<'_>) -> ControlFlow<Option<T>, bool>, ) -> (Scope, Option<T>)
Iterates depth-first over node
using PreTravel. Automatically calls Scope::exit
at suitable points.
ControlFlow::Continue
accepts a boolean to indicate whether Scope::enter
was called.
To accumulate bindings into a scope, use Index::build_scope
.
pub fn resolve_method_returntype( &self, method: Symbol<Method>, model: Spur, ) -> Option<Symbol<ModelEntry>>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Index
impl !RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more