cgp-tests 0.6.1

Context-generic programming meta crate
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use core::marker::PhantomData;

use cgp::prelude::*;

#[test]
fn test_context_with_lifetime_field() {
    #[derive(HasField)]
    pub struct Context<'a> {
        pub name: &'a str,
    }

    let context = Context { name: "test" };

    assert_eq!(context.get_field(PhantomData), &"test");
}