marker_api/ast/pat/
path_pat.rs

1use crate::ast::AstQPath;
2
3use super::CommonPatData;
4
5#[repr(C)]
6#[derive(Debug)]
7pub struct PathPat<'ast> {
8    data: CommonPatData<'ast>,
9    path: AstQPath<'ast>,
10}
11
12impl<'ast> PathPat<'ast> {
13    /// Returns the [`AstQPath`] as defined in the expression.
14    /// [`AstQPath::resolve()`] can be used to resolve the node referenced
15    /// by this path.
16    pub fn path(&self) -> &AstQPath<'ast> {
17        &self.path
18    }
19}
20
21super::impl_pat_data!(PathPat<'ast>, Path);
22
23#[cfg(feature = "driver-api")]
24impl<'ast> PathPat<'ast> {
25    pub fn new(data: CommonPatData<'ast>, path: AstQPath<'ast>) -> Self {
26        Self { data, path }
27    }
28}