Skip to main content

CodeMatch

Struct CodeMatch 

Source
pub struct CodeMatch<'tree, D: Doc> {
    pub node_match: NodeMatch<'tree, D>,
    pub context: MatchContext,
    pub relationships: Vec<CrossFileRelationship>,
}
Expand description

A pattern match that extends ast-grep NodeMatch with codebase-level context.

Preserves all NodeMatch functionality while adding cross-file relationship information needed for graph intelligence.

Fields§

§node_match: NodeMatch<'tree, D>

The underlying ast-grep NodeMatch - preserves all matching functionality

§context: MatchContext

Additional context for codebase-level analysis

§relationships: Vec<CrossFileRelationship>

Cross-file relationships (calls, imports, inheritance, etc.)

Implementations§

Source§

impl<'tree, D: Doc> CodeMatch<'tree, D>

Source

pub fn new(node_match: NodeMatch<'tree, D>) -> Self

Create a new CodeMatch wrapping an ast-grep NodeMatch

Source

pub fn ast_node_match(&self) -> &NodeMatch<'tree, D>

Get the underlying NodeMatch for full ast-grep access

Source

pub fn node(&self) -> &Node<'tree, D>

Get the matched node (delegate to NodeMatch)

Source

pub fn add_relationship(&mut self, relationship: CrossFileRelationship)

Add cross-file relationship information

Source

pub fn relationships(&self) -> &[CrossFileRelationship]

Get all cross-file relationships

Trait Implementations§

Source§

impl<'tree, D: Debug + Doc> Debug for CodeMatch<'tree, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tree, D> Freeze for CodeMatch<'tree, D>

§

impl<'tree, D> RefUnwindSafe for CodeMatch<'tree, D>
where D: RefUnwindSafe,

§

impl<'tree, D> Send for CodeMatch<'tree, D>
where D: Sync,

§

impl<'tree, D> Sync for CodeMatch<'tree, D>
where D: Sync,

§

impl<'tree, D> Unpin for CodeMatch<'tree, D>

§

impl<'tree, D> UnsafeUnpin for CodeMatch<'tree, D>

§

impl<'tree, D> UnwindSafe for CodeMatch<'tree, D>
where D: RefUnwindSafe,

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, 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> MatcherExt for T