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