From 54bc9ea1ab7bddf48d3cdc54b7c073e84bee2334 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Sat, 6 Dec 2025 15:45:04 +0800 Subject: [PATCH] wip --- specta/src/datatype/named.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/specta/src/datatype/named.rs b/specta/src/datatype/named.rs index c3a12d55..76e0c905 100644 --- a/specta/src/datatype/named.rs +++ b/specta/src/datatype/named.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, panic::Location}; +use std::{borrow::Cow, collections::HashSet, panic::Location}; use crate::SpectaID; @@ -14,6 +14,7 @@ pub struct NamedDataType { pub(crate) module_path: Cow<'static, str>, pub(crate) location: Location<'static>, pub(crate) generics: Vec, + pub(crate) tags: HashSet, pub(crate) inner: DataType, } @@ -122,6 +123,21 @@ impl NamedDataType { pub fn set_ty(&mut self, ty: DataType) { self.inner = ty; } + + /// Get the tags associated with this type + pub fn tags(&self) -> &HashSet { + &self.tags + } + + /// Get a mutable reference to the tags associated with this type + pub fn tags_mut(&mut self) -> &mut HashSet { + &mut self.tags + } + + /// Set the tags associated with this type + pub fn set_tags(&mut self, tags: HashSet) { + self.tags = tags; + } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -139,3 +155,10 @@ pub enum DeprecatedType { note: Cow<'static, str>, }, } + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum TypeTag { + Date, + Custom(Cow<'static, str>), +}