mina_p2p_messages/
phantom.rs1use std::marker::PhantomData;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
6pub struct Phantom<T>(PhantomData<T>);
7
8impl<T> binprot::BinProtRead for Phantom<T> {
9 fn binprot_read<R: std::io::Read + ?Sized>(_r: &mut R) -> Result<Self, binprot::Error>
10 where
11 Self: Sized,
12 {
13 Ok(Self(PhantomData))
14 }
15}
16
17impl<T> binprot::BinProtWrite for Phantom<T> {
18 fn binprot_write<W: std::io::Write>(&self, _w: &mut W) -> std::io::Result<()> {
19 Ok(())
20 }
21}