oneline_template/function_executor/
function_schema.rs1use crate::function_executor::function_argument::FunctionArgument;
2
3#[derive(Debug)]
5pub struct FunctionSchema {
6 function_name: String,
7 arguments: Vec<FunctionArgument>,
8}
9
10impl FunctionSchema {
11 pub fn new(
17 function_name: impl Into<String>,
18 ) -> FunctionSchema {
19 let function_name = function_name.into();
20 if function_name.is_empty() {
21 panic!("Passed function name is empty");
22 }
23 return FunctionSchema {
24 function_name,
25 arguments: Vec::new(),
26 }
27 }
28
29 pub fn with_argument(mut self, argument: FunctionArgument) -> Self {
31 self.arguments.push(argument);
32 return self;
33 }
34
35 pub fn get_function_name(&self) -> &String {
37 return &self.function_name;
38 }
39
40
41 pub fn get_arguments(&self) -> &[FunctionArgument] {
43 return &self.arguments;
44 }
45}