From 7dafc99afe49b062cf18d572c80d9bdf2b375788 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sat, 11 Nov 2023 20:17:54 +0800 Subject: [PATCH] dev(core): add PhantomParamData --- core/src/concepts/marker.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/concepts/marker.rs b/core/src/concepts/marker.rs index d670e7268..5f6010e8e 100644 --- a/core/src/concepts/marker.rs +++ b/core/src/concepts/marker.rs @@ -7,6 +7,18 @@ use serde_with::{ }; use serde_with::{DeserializeAs, SerializeAs}; +/// Generic marker for type that only occurs in parameter position. +/// +/// Safety: The signature is type checked by the compiler. +pub struct PhantomParamData(std::marker::PhantomData); +unsafe impl Send for PhantomParamData {} + +impl Default for PhantomParamData { + fn default() -> Self { + Self(Default::default()) + } +} + /// This is an implementation for `Write + !AsRef`. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct AsWritable;