Skip to main content

java_lang/ast/
generics.rs

1//! Generic type parameter types.
2
3use crate::{ident::Ident, span::Span};
4
5use super::{attribute::Annotation, path::Path};
6
7/// Type parameters: `<T extends Comparable<T>, U>`.
8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct TypeParameters {
10    pub params: Vec<TypeParameter>,
11    pub lt_span: Span,
12    pub gt_spans: Vec<Span>,
13}
14
15/// A single type parameter.
16#[derive(Debug, Clone, PartialEq, Eq, Hash)]
17pub struct TypeParameter {
18    pub annotations: Vec<Annotation>,
19    pub name: Ident,
20    pub bound: Option<TypeBound>,
21    pub span: Span,
22}
23
24/// A type bound: `extends Type & Type2`.
25#[derive(Debug, Clone, PartialEq, Eq, Hash)]
26pub struct TypeBound {
27    pub first: Path,
28    pub additional: Vec<Path>,
29    pub extends_span: Span,
30}