reactive_graph_model_meta/reactive_graph/meta/
describable.rs

1//! ---------------------------------------------
2//! This file was generated automatically.
3//! ---------------------------------------------
4#![allow(dead_code, unused)]
5#![cfg_attr(rustfmt, rustfmt_skip)]
6
7/// Namespace `reactive_graph::meta::Describable`
8#[cfg_attr(rustfmt, rustfmt_skip)]
9pub const DESCRIBABLE_NAMESPACE: &str = "reactive_graph::meta::Describable";
10
11/// The [type identifier]() of Component `Describable`.
12///
13/// ### Namespace
14///
15/// The fully qualified namespace is
16/// `reactive_graph::meta::Describable`
17pub static DESCRIBABLE: std::sync::LazyLock<reactive_graph_graph::ComponentTypeId> = std::sync::LazyLock::new(||
18std::str::FromStr::from_str(DESCRIBABLE_NAMESPACE).unwrap());
19
20/// The properties of Component `Describable`.
21#[allow(non_camel_case_types)]
22#[derive(Debug, PartialEq, PartialOrd, Eq, Hash, Clone)]
23pub enum DescribableProperties {
24    
25    /// ### Property `description`
26    ///
27    /// The description of an entity or a relation
28    ///
29    /// Data Type: `String`
30    ///
31    /// Socket Type: `None`
32    ///
33    /// Mutability: `Mutable`
34    ///
35    DESCRIPTION,
36}
37impl DescribableProperties {
38    pub fn len() -> usize {
39        1usize
40    }
41    
42    pub fn property_types() -> reactive_graph_graph::PropertyTypes {
43        let property_types = reactive_graph_graph::PropertyTypes::new();
44        property_types.push(DescribableProperties::DESCRIPTION);
45        property_types
46    }
47}
48
49impl AsRef<str> for DescribableProperties {
50    #[inline]
51    fn as_ref(&self) -> &str {
52        match *self {
53            DescribableProperties::DESCRIPTION => "description",
54        }
55    }
56}
57
58impl From<DescribableProperties> for &'static str {
59    #[inline]
60    fn from(properties: DescribableProperties) -> &'static str {
61        match properties {
62            DescribableProperties::DESCRIPTION => "description",
63        }
64    }
65}
66
67impl From<DescribableProperties> for String {
68    #[inline]
69    fn from(properties: DescribableProperties) -> String {
70        match properties {
71            DescribableProperties::DESCRIPTION => "description".to_owned(),
72        }
73    }
74}
75
76impl From<DescribableProperties> for reactive_graph_graph::PropertyType {
77    #[inline]
78    fn from(properties: DescribableProperties) -> reactive_graph_graph::PropertyType {
79        match properties {
80            DescribableProperties::DESCRIPTION => {
81                reactive_graph_graph::PropertyType::new_with_all(
82                    "description",
83                    "The description of an entity or a relation",
84                    reactive_graph_graph::DataType::String,
85                    reactive_graph_graph::SocketType::None,
86                    reactive_graph_graph::Mutability::Mutable,
87                    reactive_graph_graph::Extensions::new(),
88                )
89            }
90        }
91    }
92}
93
94pub struct DescribablePropertiesIterator(Option<DescribableProperties>);
95
96impl DescribableProperties {
97    pub fn into_iter() -> DescribablePropertiesIterator {
98        DescribablePropertiesIterator(None)
99    }
100}
101
102impl Iterator for DescribablePropertiesIterator {
103    type Item = DescribableProperties;
104    fn next(&mut self) -> Option<Self::Item> {
105        self.0 = match self.0 {
106            None => Some(DescribableProperties::DESCRIPTION),
107            Some(DescribableProperties::DESCRIPTION) => None,
108        };
109        self.0.clone()
110    }
111}
112
113impl IntoIterator for DescribableProperties {
114    type Item = DescribableProperties;
115    type IntoIter = DescribablePropertiesIterator;
116    fn into_iter(self) -> Self::IntoIter {
117        DescribablePropertiesIterator(None)
118    }
119}
120
121impl core::fmt::Display for DescribableProperties {
122    fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
123        match *self {
124            DescribableProperties::DESCRIPTION => {
125                core::fmt::Display::fmt("description", f)
126            }
127        }
128    }
129}
130
131///
132pub static DESCRIBABLE_EXTENSIONS: std::sync::LazyLock<
133    reactive_graph_graph::Extensions,
134> = std::sync::LazyLock::new(|| { reactive_graph_graph::Extensions::new() });
135
136pub static DESCRIBABLE_TYPE: std::sync::LazyLock<reactive_graph_graph::Component> = std::sync::LazyLock::new(||
137{
138    reactive_graph_graph::Component::builder()
139        .ty(core::ops::Deref::deref(&DESCRIBABLE))
140        .description("The entity or relation has a description.")
141        .properties(DescribableProperties::property_types())
142        .build()
143});
144
145/// # Component `Describable`
146///
147/// ## Fully Qualified Namespace
148///
149/// `reactive_graph::meta::Describable`
150///
151/// ## Description
152///
153/// The entity or relation has a description.
154///
155/// ### Properties
156///
157/// - description
158///
159/// ## JSON Schema
160///
161/// [https://schema.reactive-graph.io/schema/json/dynamic_graph/types/component/reactive_graph/meta/Describable.schema.json]()
162///
163pub trait Describable {
164    
165    /// ### Property `description`
166    ///
167    /// The description of an entity or a relation
168    ///
169    /// Data Type: `String`
170    ///
171    /// Socket Type: `None`
172    ///
173    /// Mutability: `Mutable`
174    ///
175    fn description(&self) -> String;
176    
177    /// ### Property `description`
178    ///
179    /// The description of an entity or a relation
180    ///
181    /// Data Type: `String`
182    ///
183    /// Socket Type: `None`
184    ///
185    /// Mutability: `Mutable`
186    ///
187    fn set_description(&mut self, description: String);
188}