flatc-rust icon indicating copy to clipboard operation
flatc-rust copied to clipboard

Improve ergonomics when dealing with `glob`s.

Open dunmatt opened this issue 4 years ago • 3 comments

Would it be possible to change flatc_rust::Args.inputs to accept things of type AsRef<Path> instead of regular Path? That way it could accept PathBufs as well, which would make it easier to get it to interact with the glob crate.

Would it be easy enough that a intermediate Rustacean might be able to send you a PR?

dunmatt avatar Aug 08 '19 16:08 dunmatt

@dunmatt interestingly enough, two out of two issues about this crate suggest fixing this :) (ref #3)

I am happy to receive PRs! You are very welcome!

frol avatar Aug 08 '19 16:08 frol

Uh oh, the other guy finding it prohibitively difficult isn't a good sign... I'll give it a shot but no guarantees...

dunmatt avatar Aug 08 '19 16:08 dunmatt

Another use case for this is for hard-coded &str paths instead of having to create a Path object for it, e.g.

let flatbuffers = &[
    "buffer1.fbs",
    "buferfer.fbs",
  ];
  
let args_rs = flatc_rust::Args {
    lang: "rust",
    inputs: flatbuffers,
    ..Default::default()
  };

rminderhoud avatar Feb 16 '21 17:02 rminderhoud