use quote::ToTokens; use spindle_db::{ map::{AsDbInOut, AsDbMap}, primitive::AsDbPrimitive, union::AsDbUnion, }; use crate::{ case::PrimitiveIdent, map::{in_out::InOut, MapFn}, primitives::_Primitive, union::NewUnion, }; impl AsDbPrimitive for _Primitive { fn db_ident(&self) -> String { self.ident.0.to_string() } } impl AsDbInOut for InOut { type Primitive = _Primitive; fn db_inout(&self) -> (Option, Option) { (self.input.clone(), self.output.clone()) } } impl AsDbMap for MapFn { type InOut = InOut; fn db_ident(&self) -> String { self.item_fn.sig.ident.to_string() } fn db_content(&self) -> String { self.item_fn.clone().to_token_stream().to_string() } fn db_inouts(&self) -> Vec { self.in_outs.clone() } } impl AsDbUnion for NewUnion { type Primitive = PrimitiveIdent; fn db_ident(&self) -> String { self.0 .0.to_string() } fn db_fields(&self) -> Vec { self.1.clone() } } impl AsDbPrimitive for PrimitiveIdent { fn db_ident(&self) -> String { self.0.to_string() } }