Skip to content

Releases: ZihanType/from-attr

0.1.2

28 May 05:24
Compare
Choose a tag to compare
  • feat: add Map, which supports the following:
    #[derive(FromAttr, PartialEq, Eq, Debug)]
    #[attribute(idents = [test])]
    struct Test {
         a: Map<i32, String>,
    }
    
    let attrs = [parse_quote!(#[test(a = { 1 : "hi", 2 : "ho" })])];
    
    assert_eq!(
        Test::from_attributes(&attrs).unwrap().unwrap().value,
        Test {
            a: Map(vec![(1, "hi".to_string()), (2, "ho".to_string())])
        }
    );

0.1.1

07 May 10:32
Compare
Choose a tag to compare
  • feat: add the simpler syntax in case all parameters have default values.

    #[one(a, b, c)]
    

    if a, b, c all have default value, it should be allowed to be written as #[one] instead of having to be written as #[one()].