#![feature(proc_macro)]
extern crate fn_mut;
use fn_mut::fn_mut;

struct Test1(u64);

impl Test1 {
    #[fn_mut]
    fn test1(&self, text: &str) -> u64 

    #[fn_mut(enable_attrs = "text")]
    fn test2(&self, text: &str) -> Option<&u64> {
        if_mut! {
            println!("This is mut fn: {}", text);
        }
        if_const! {
            println!("This is const fn: {}", text);
        }
        Some(ptr!(self.0))
    }
}

#[test]
fn test1() {
    let mut t = Test1(1);
    assert_eq!(t.test2("const"), Some(&1));
    let mut s = String::from("mut");
    assert_eq!(t.test2_mut(&mut s), Some(&mut 1));
    assert_eq!(t.test1("const"), 21);
    assert_eq!(t.test1_mut("const"), 11);
}

{
        if_mut! {
            self.0 + 10
        }
        if_const! {
            self.0 + 20
        }
    }