pub struct ParsedDocument<D>where
D: Doc,{
pub ast_root: Root<D>,
pub file_path: PathBuf,
pub language: SupportLang,
pub content_fingerprint: Fingerprint,
pub metadata: DocumentMetadata,
/* private fields */
}Expand description
A parsed document that wraps ast-grep Root with additional codebase-level metadata.
This type preserves all ast-grep functionality while adding context needed for cross-file analysis and graph intelligence. It acts as the bridge between file-level AST operations and codebase-level relational analysis.
Fields§
§ast_root: Root<D>The underlying ast-grep Root - preserves all ast-grep functionality
file_path: PathBufSource file path for this document
language: SupportLangLanguage of this document
content_fingerprint: FingerprintContent fingerprint for deduplication and change detection (blake3 hash)
metadata: DocumentMetadataCodebase-level metadata (symbols, imports, exports, etc.)
Implementations§
Source§impl<D> ParsedDocument<D>where
D: Doc,
impl<D> ParsedDocument<D>where
D: Doc,
Sourcepub fn new(
ast_root: Root<D>,
file_path: PathBuf,
language: SupportLang,
content_fingerprint: Fingerprint,
) -> ParsedDocument<D>
pub fn new( ast_root: Root<D>, file_path: PathBuf, language: SupportLang, content_fingerprint: Fingerprint, ) -> ParsedDocument<D>
Create a new ParsedDocument wrapping an ast-grep Root
Sourcepub fn ast_grep_root(&self) -> &Root<D>
pub fn ast_grep_root(&self) -> &Root<D>
Get the underlying ast-grep Root for full access to capabilities
Sourcepub fn ast_grep_root_mut(&mut self) -> &mut Root<D>
pub fn ast_grep_root_mut(&mut self) -> &mut Root<D>
Get mutable access to ast-grep Root for replacements
Sourcepub fn pin_for_threading(&self) -> PinnedNodeData<D, Node<'static, D>>
pub fn pin_for_threading(&self) -> PinnedNodeData<D, Node<'static, D>>
Create a pinned version for cross-thread/FFI usage
Sourcepub fn generate(&self) -> String
pub fn generate(&self) -> String
Generate the source code (preserves ast-grep replacement functionality)
Sourcepub fn metadata(&self) -> &DocumentMetadata
pub fn metadata(&self) -> &DocumentMetadata
Get document metadata for codebase-level analysis
Sourcepub fn metadata_mut(&mut self) -> &mut DocumentMetadata
pub fn metadata_mut(&mut self) -> &mut DocumentMetadata
Get mutable document metadata
Trait Implementations§
Auto Trait Implementations§
impl<D> !RefUnwindSafe for ParsedDocument<D>
impl<D> !UnwindSafe for ParsedDocument<D>
impl<D> Freeze for ParsedDocument<D>where
D: Freeze,
impl<D> Send for ParsedDocument<D>
impl<D> Sync for ParsedDocument<D>
impl<D> Unpin for ParsedDocument<D>where
D: Unpin,
impl<D> UnsafeUnpin for ParsedDocument<D>where
D: UnsafeUnpin,
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