1use crate::prelude::*;
2
3use crate::{Attributes, Identifier, Type, Visibility};
4
5pub mod parameter;
6pub mod method;
7pub mod synchrony;
8
9pub use parameter::*;
10pub use method::*;
11pub use synchrony::*;
12
13#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
15pub struct Function {
16 pub attributes: Attributes,
18 pub visibility: Visibility,
20 pub synchrony: Synchrony,
22 pub identifier: Identifier,
24 pub inputs: Vec<Parameter>,
26 pub output: Option<Type>,
28}
29
30impl CountSymbols for Vec<Function> {
31 fn count_symbols(&self) -> usize {
32 self.len()
33 }
34}
35
36impl CountSymbols for &Vec<Function> {
37 fn count_symbols(&self) -> usize {
38 self.len()
39 }
40}
41
42impl From<Method> for Function {
43 fn from(method: Method) -> Self {
44 Self {
45 attributes: method.attributes,
46 visibility: method.visibility,
47 synchrony: method.synchrony,
48 identifier: method.identifier,
49 inputs: method.inputs,
50 output: method.output,
51 }
52 }
53}
54
55#[cfg(any(test, feature = "mocks"))]
56pub mod mock;