From d6158663fe5ac629f473e6180d93ee3bd4b3789e Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:09:22 +0800 Subject: [PATCH] dev(core): add PhantomParamData (#410) --- 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;