Skip to content

Commit

Permalink
dev(core): add PhantomParamData (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Nov 13, 2023
1 parent c9ee300 commit d615866
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/concepts/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<X>(std::marker::PhantomData<X>);
unsafe impl<X> Send for PhantomParamData<X> {}

impl<X> Default for PhantomParamData<X> {
fn default() -> Self {
Self(Default::default())
}
}

/// This is an implementation for `Write + !AsRef<AnyBytes>`.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AsWritable;
Expand Down

0 comments on commit d615866

Please sign in to comment.