Struct Index

Source
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

Source

pub fn delete_marked_entries(&self)

Source

pub async fn add_root( &self, root: &Path, client: Option<Client>, tsconfig: bool, ) -> Result<Option<AddRootResults>>

Source

pub fn remove_root(&self, root: &Path)

Source

pub fn module_of_path(&self, path: &Path) -> Option<ModuleName>

Has complexity of O(len(self.roots))

Source§

impl Index

Source

pub fn model_of_range( &self, node: Node<'_>, range: ByteRange, contents: &[u8], ) -> Option<ModelName>

Source

pub fn type_of_range( &self, node: Node<'_>, range: ByteRange, contents: &[u8], ) -> Option<(Type, Scope)>

Source

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.

Source

pub fn type_of( &self, node: Node<'_>, scope: &Scope, contents: &[u8], ) -> Option<Type>

Type::Value is not returned by this method.

Source

pub fn type_of_attribute( &self, type_: &Type, attr: &[u8], scope: &Scope, ) -> Option<Type>

Source

pub fn has_attribute(&self, type_: &Type, attr: &[u8], scope: &Scope) -> bool

Source

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.

Source

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.

Source

pub fn resolve_method_returntype( &self, method: Symbol<Method>, model: Spur, ) -> Option<Symbol<ModelEntry>>

Trait Implementations§

Source§

impl Default for Index

Source§

fn default() -> Self

Return Index { roots: DashMap :: with_shard_amount(4), records: Default::default(), templates: Default::default(), models: Default::default(), components: Default::default(), widgets: DashMap :: with_shard_amount(4), actions: DashMap :: with_shard_amount(4) }

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more