-
-
Save rust-play/77f765c79c13afb3899c376d51e2eb77 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::marker::PhantomData; | |
use serde::Serialize; | |
#[derive(Serialize)] | |
struct A<T>(PhantomData<T>); | |
#[derive(Serialize)] | |
struct B<T>(A<T>); | |
type GhostlyData<T> = PhantomData<T>; | |
#[derive(Serialize)] | |
struct C<T>(GhostlyData<T>); | |
struct NotSerialize; | |
fn assert_serialize<T: Serialize>() {} | |
fn main() { | |
assert_serialize::<A<NotSerialize>>(); | |
// assert_serialize::<B<NotSerialize>>(); | |
// assert_serialize::<C<NotSerialize>>(); | |
println!("Hello, world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment