Skip to main content

luaur_analysis/records/
serialized_generic.rs

1use alloc::string::String;
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4pub struct SerializedGeneric<T> {
5    pub(crate) is_named: bool,
6    pub(crate) name: String,
7    pub(crate) r#type: T,
8}
9
10impl<T: Default> Default for SerializedGeneric<T> {
11    fn default() -> Self {
12        Self {
13            is_named: false,
14            name: String::new(),
15            r#type: T::default(),
16        }
17    }
18}
19
20#[allow(non_snake_case)]
21impl<T> SerializedGeneric<T> {
22    pub fn isNamed(&self) -> bool {
23        self.is_named
24    }
25
26    pub fn name(&self) -> &str {
27        &self.name
28    }
29
30    pub fn r#type(&self) -> &T {
31        &self.r#type
32    }
33}