Skip to main content

AnnotationStore

Struct AnnotationStore 

Source
pub struct AnnotationStore { /* private fields */ }
Expand description

In-memory index of annotation sidecar files.

Implementations§

Source§

impl AnnotationStore

Source

pub fn new(project_root: &Path) -> Self

Create an empty store rooted at the given project directory. Uses colocated sidecar strategy by default.

Source

pub fn with_locator( project_root: &Path, locator: Arc<dyn SidecarLocator>, ) -> Self

Create an empty store with a custom sidecar locator strategy.

Source

pub fn locator(&self) -> &dyn SidecarLocator

Return the sidecar locator used by this store.

Source

pub fn load_all_from_locator(&mut self) -> Vec<String>

Discover and load all sidecar files using the configured locator. Returns parse errors for files that failed to load.

Source

pub fn load_all(&mut self, sidecar_paths: &[PathBuf]) -> Vec<String>

Load from pre-resolved sidecar paths (backward-compatible). Returns parse errors for files that failed to load.

Source

pub fn load_file(&mut self, sidecar_path: &Path) -> Result<(), String>

Load or reload a single sidecar file. Returns Err if the sidecar exists but fails to parse. Returns Ok(()) if loaded successfully or the file was removed.

Source

pub fn refresh_if_stale(&mut self, rel_source: &RelativePath) -> bool

Check mtime and reload if the sidecar changed. Entries with no sidecar path (extractor-only or load_xml) are skipped.

Source

pub fn is_stale(&self, rel_source: &RelativePath) -> bool

Check whether a file’s sidecar is stale (mtime changed on disk).

Returns true if the sidecar file on disk has a newer mtime than the cached entry, or if the sidecar file no longer exists. Returns false for extractor-only entries (no sidecar path).

Source

pub fn get_file_annotations(&self, rel_source: &str) -> Vec<&Annotation>

Get cached code element tree for a file.

Accepts a source path (src/api.ts) or sidecar path (src/api.aqm). Falls back to stem-prefix matching when an exact key is not found.

Source

pub fn get_all_annotations(&self) -> Vec<&Annotation>

Get all annotations across all files.

Source

pub fn get_scope_annotations(&self, scope: &Scope) -> Vec<&Annotation>

Return annotations from files whose relative path starts with scope.

Source

pub fn select( &self, selector_str: &str, file: Option<&str>, scope: Option<&str>, opts: Option<&QueryOptions>, ) -> Result<Vec<Annotation>, AqlError>

Query annotations by selector string. If file is provided, only search that file’s annotations. If scope is provided, only search annotations under that directory prefix. Supports combinator selectors for nested annotations (e.g. parser > helper).

Source

pub fn refresh_scope(&mut self, scope: &Scope) -> Vec<String>

Refresh all sidecar files whose rel_source starts with scope. Also discovers newly added sidecar files via the locator. Returns parse errors encountered during discovery. If scope is empty, refreshes all files.

Source

pub fn annotations_in_scope( &self, scope: &Scope, ) -> Vec<(&RelativePath, Vec<&Annotation>)>

Get all annotations grouped by file within a scope prefix.

Source

pub fn file_count(&self) -> usize

Number of loaded annotation files.

Source

pub fn annotated_files(&self) -> Vec<RelativePath>

All source file paths that have annotations.

Source

pub fn load_xml( &mut self, rel_source: &RelativePath, xml: &str, ) -> Result<(), AqlError>

Load annotations from an XML string for a given relative source path. Unlike load_file, this does not touch the filesystem. Returns Err if the XML is malformed.

Source

pub fn load_extractor_output(&mut self, annotations: Vec<Annotation>)

Load annotations from extractor output, merging with existing sidecar data.

For bindings that already exist in sidecar files, sidecar attributes take precedence — extractor attrs are only used as defaults.

Auto Trait Implementations§

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, 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.