Add simple `attribute_path` function

finchie
Feb 14, 2024, 8:57 AM
QSK7JRBA55ZRY322WXGNRROJL7NTFBR6MJPOOA5B2XD2JAVM4MWQC

Dependencies

  • [2] XGNME3WR Move `Group::derive_enum` to new `crate::parse_macro` module
  • [3] UOMQT7LT Add support for cardinal CLDR plural selectors
  • [4] 5TEX4MNU Split `fluent_embed` into `group` and `parse` modules
  • [*] O77KA6C4 Create `fluent_embed` crate

Change contents

  • edit in fluent_embed/src/parse_macro.rs at line 1
    [2.39]
    [2.40]
    use std::path::PathBuf;
  • edit in fluent_embed/src/parse_macro.rs at line 49
    [2.1589]
    [2.1589]
    }
    }
    }
    pub fn attribute_path(attribute: syn::Attribute) -> PathBuf {
    match attribute.meta {
    syn::Meta::List(list_data) => {
    let path_literal: syn::LitStr = syn::parse2(list_data.tokens).unwrap();
    let supplied_path = PathBuf::from(path_literal.value());
    // TODO: path should be relative to source file, not working directory
    supplied_path.canonicalize().unwrap()
  • edit in fluent_embed/src/parse_macro.rs at line 62
    [2.1599]
    [2.1599]
    syn::Meta::Path(_) => todo!(),
    syn::Meta::NameValue(_) => todo!(),
  • replacement in fluent_embed/src/lib.rs at line 6
    [3.3509][2.1626:1660]()
    pub use parse_macro::derive_enum;
    [3.3509]
    pub use parse_macro::{attribute_path, derive_enum};