68 lines
1.7 KiB
Rust
68 lines
1.7 KiB
Rust
use crate::ast::node::generics::GenericParameters;
|
|
use crate::ast::node::implements_list::ImplementsList;
|
|
use crate::ast::node::level::InterfaceLevelDeclaration;
|
|
use crate::ast::node::names::Identifier;
|
|
|
|
#[derive(Debug)]
|
|
pub struct InterfaceDeclaration {
|
|
is_public: bool,
|
|
identifier: Box<Identifier>,
|
|
generics: Box<GenericParameters>,
|
|
implements: Box<ImplementsList>,
|
|
declarations: Vec<Box<InterfaceLevelDeclaration>>,
|
|
}
|
|
|
|
impl InterfaceDeclaration {
|
|
pub fn new(
|
|
is_public: bool,
|
|
identifier: Box<Identifier>,
|
|
generics: Box<GenericParameters>,
|
|
implements: Box<ImplementsList>,
|
|
declarations: Vec<Box<InterfaceLevelDeclaration>>,
|
|
) -> Self {
|
|
Self {
|
|
is_public,
|
|
identifier,
|
|
generics,
|
|
implements,
|
|
declarations,
|
|
}
|
|
}
|
|
|
|
pub fn is_public(&self) -> bool {
|
|
self.is_public
|
|
}
|
|
|
|
pub fn identifier(&self) -> &Identifier {
|
|
&self.identifier
|
|
}
|
|
|
|
pub fn identifier_mut(&mut self) -> &mut Identifier {
|
|
&mut self.identifier
|
|
}
|
|
|
|
pub fn generics(&self) -> &GenericParameters {
|
|
&self.generics
|
|
}
|
|
|
|
pub fn generics_mut(&mut self) -> &mut GenericParameters {
|
|
&mut self.generics
|
|
}
|
|
|
|
pub fn implements(&self) -> &ImplementsList {
|
|
&self.implements
|
|
}
|
|
|
|
pub fn implements_mut(&mut self) -> &mut ImplementsList {
|
|
&mut self.implements
|
|
}
|
|
|
|
pub fn declarations(&self) -> Vec<&InterfaceLevelDeclaration> {
|
|
self.declarations.iter().map(Box::as_ref).collect()
|
|
}
|
|
|
|
pub fn declarations_mut(&mut self) -> Vec<&mut InterfaceLevelDeclaration> {
|
|
self.declarations.iter_mut().map(Box::as_mut).collect()
|
|
}
|
|
}
|