Skip to main content

nominal_api/conjure/objects/module/
function.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct Function {
13    #[builder(into)]
14    #[serde(rename = "name")]
15    name: String,
16    #[builder(into)]
17    #[serde(rename = "description")]
18    description: String,
19    #[builder(default, list(item(type = super::FunctionParameter)))]
20    #[serde(rename = "parameters", skip_serializing_if = "Vec::is_empty", default)]
21    parameters: Vec<super::FunctionParameter>,
22    #[builder(custom(type = super::FunctionNode, convert = Box::new))]
23    #[serde(rename = "functionNode")]
24    function_node: Box<super::FunctionNode>,
25    #[serde(rename = "isExported")]
26    is_exported: bool,
27}
28impl Function {
29    /// The name of the function. This should be unique to the function in the current module.
30    #[inline]
31    pub fn name(&self) -> &str {
32        &*self.name
33    }
34    #[inline]
35    pub fn description(&self) -> &str {
36        &*self.description
37    }
38    #[inline]
39    pub fn parameters(&self) -> &[super::FunctionParameter] {
40        &*self.parameters
41    }
42    #[inline]
43    pub fn function_node(&self) -> &super::FunctionNode {
44        &*self.function_node
45    }
46    #[inline]
47    pub fn is_exported(&self) -> bool {
48        self.is_exported
49    }
50}