tomhoule / purescript-waterslide-rs

Generate Purescript types from your Rust types. (unmaintained)
Apache License 2.0
41 stars 4 forks source link

Take &str instead of String in purs_module!() #41

Open Boscop opened 6 years ago

Boscop commented 6 years ago

It would be more ergonomic:

purs_module!("Data.Dogs"; Dachsund, ChowChow, Mutt<Void, Void>)

PursModule would have an added lifetime <'a> and member name would be &'a str.

tomhoule commented 6 years ago

This should not be a problem, especially since I think for most use-cases a string literal is going to be used there. I have no objection to this making it into the release (next time I have time to work on this project).

Boscop commented 6 years ago

It could also be done by calling .to_string() in the macro before constructing the PursModule. Then PursModule wouldn't need to track that lifetime.