1use crate::{Attributes, Object, Function, Identifier, Method, Path, Visibility};
2use crate::prelude::*;
3
4#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
5pub struct Interface {
6 pub attributes: Attributes,
8 pub visibility: Visibility,
10 pub identifier: Identifier,
12 pub objects: Vec<Object>,
14 pub functions: Vec<Function>,
16 pub methods: Vec<Method>,
18 pub interfaces: Vec<Path>
20}
21
22impl CountSymbols for &Vec<Interface> {
23 fn count_symbols(&self) -> usize {
24 self.iter().fold(0, |acc, interface| acc + interface.count_symbols())
25 }
26}
27
28impl CountSymbols for Vec<Interface> {
29 fn count_symbols(&self) -> usize {
30 self.iter().fold(0, |acc, interface| acc + interface.count_symbols())
31 }
32}
33
34impl CountSymbols for &Interface {
35 fn count_symbols(&self) -> usize {
36 self.objects.count_symbols()
37 + self.functions.count_symbols()
38 + self.methods.count_symbols()
39 }
40}
41
42impl CountSymbols for Interface {
43 fn count_symbols(&self) -> usize {
44 self.objects.count_symbols()
45 + self.functions.count_symbols()
46 + self.methods.count_symbols()
47 }
48}