wright/ast/decl/implementation.rs
1//! Implementation blocks, such as `impl Point { func origin() -> Point { ... } }`.
2
3use super::Item;
4use crate::ast::{identifier::Identifier, ty::Type};
5use crate::source_tracking::fragment::Fragment;
6
7/// An `impl` block, which associates items (functions, constants, and type aliases) with a type.
8#[derive(Debug, Clone, PartialEq)]
9pub struct ImplDecl {
10 /// Full matching source of the declaration.
11 pub matching_source: Fragment,
12
13 /// Generic type parameters, such as the `T` in `impl<T> Wrapper<T> { ... }`.
14 pub generics: Vec<Identifier>,
15
16 /// The type the items are associated with.
17 pub target: Type,
18
19 /// The items in the block. The parser only allows functions, constants, and type aliases here.
20 pub items: Vec<Item>,
21}