pub struct AST<'src> {
pub items: Vec<Item<'src>>,
/* private fields */
}
Expand description
Abstract Syntax Tree (AST) for YARA rules.
Fields§
§items: Vec<Item<'src>>
The list of items in the AST (imports, includes, and rules).
Implementations§
Source§impl<'src> AST<'src>
impl<'src> AST<'src>
Sourcepub fn items(&self) -> impl Iterator<Item = &Item<'src>>
pub fn items(&self) -> impl Iterator<Item = &Item<'src>>
Returns the top level items in the AST.
A top level item can be an import, include, or rule.
Sourcepub fn imports(&self) -> impl Iterator<Item = &Import<'src>>
pub fn imports(&self) -> impl Iterator<Item = &Import<'src>>
Returns the import statements in the AST.
Sourcepub fn into_errors(self) -> Vec<Error>
pub fn into_errors(self) -> Vec<Error>
Consumes the parser, and returns the errors found while parsing the source code as a vector.
Trait Implementations§
Auto Trait Implementations§
impl<'src> Freeze for AST<'src>
impl<'src> RefUnwindSafe for AST<'src>
impl<'src> Send for AST<'src>
impl<'src> Sync for AST<'src>
impl<'src> Unpin for AST<'src>
impl<'src> UnwindSafe for AST<'src>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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