| 1 |
use super::{imports::Imports, *}; |
| 2 |
use crate::{codegen::Visibility, library, version::Version}; |
| 3 |
|
| 4 |
#[derive(Debug, Default)] |
| 5 |
pub struct InfoBase { |
| 6 |
pub full_name: String, |
| 7 |
pub type_id: library::TypeId, |
| 8 |
pub name: String, |
| 9 |
pub functions: Vec<functions::Info>, |
| 10 |
pub specials: special_functions::Infos, |
| 11 |
pub imports: Imports, |
| 12 |
pub version: Option<Version>, |
| 13 |
pub deprecated_version: Option<Version>, |
| 14 |
pub cfg_condition: Option<String>, |
| 15 |
pub concurrency: library::Concurrency, |
| 16 |
pub visibility: Visibility, |
| 17 |
} |
| 18 |
|
| 19 |
impl InfoBase { |
| 20 |
/// TODO: return iterator |
| 21 |
pub fn constructors(&self) -> Vec<&functions::Info> { |
| 22 |
self.functions |
| 23 |
.iter() |
| 24 |
.filter(|f| f.status.need_generate() && f.kind == library::FunctionKind::Constructor) |
| 25 |
.collect() |
| 26 |
} |
| 27 |
|
| 28 |
pub fn methods(&self) -> Vec<&functions::Info> { |
| 29 |
self.functions |
| 30 |
.iter() |
| 31 |
.filter(|f| f.status.need_generate() && f.kind == library::FunctionKind::Method) |
| 32 |
.collect() |
| 33 |
} |
| 34 |
|
| 35 |
pub fn functions(&self) -> Vec<&functions::Info> { |
| 36 |
self.functions |
| 37 |
.iter() |
| 38 |
.filter(|f| f.status.need_generate() && f.kind == library::FunctionKind::Function) |
| 39 |
.collect() |
| 40 |
} |
| 41 |
} |