use serde::{Deserialize, Serialize}; use std::ops::{Deref, DerefMut}; use ts_rs::TS; pub use magnetar_mmm_parser as mmm; pub mod endpoints; pub mod types; pub mod util_types; #[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] #[repr(transparent)] pub struct Required(pub T); impl TS for Required { const EXPORT_TO: Option<&'static str> = None; fn decl() -> String { unimplemented!() } fn name() -> String { T::name() } fn inline() -> String { T::name() } fn inline_flattened() -> String { unimplemented!() } fn dependencies() -> Vec { ts_rs::Dependency::from_ty::().into_iter().collect() } fn transparent() -> bool { false } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] #[repr(transparent)] pub struct Optional(pub Option); impl TS for Optional { const EXPORT_TO: Option<&'static str> = None; fn decl() -> String { unimplemented!() } fn name() -> String { T::name() } fn inline() -> String { format!("Partial<{}>", T::name()) } fn inline_flattened() -> String { unimplemented!() } fn dependencies() -> Vec { ts_rs::Dependency::from_ty::().into_iter().collect() } fn transparent() -> bool { false } } impl Deref for Optional { type Target = Option; fn deref(&self) -> &Self::Target { &self.0 } } impl DerefMut for Optional { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } pub trait Packed: 'static { type Input: 'static; fn pack_from(val: Self::Input) -> Self; }