syn
                                
                                
                                
                                    syn copied to clipboard
                            
                            
                            
                        Consider providing a `parse_file_with` function to support shebang-handling in preprocessors
It would be useful to have a function available with a signature of
fn parse_file_with<T, F>(content: &str, parse: F) -> (Option<String>, Result<T>)
    where 
        T: Parse,
        F: FnOnce(&str) -> Result<T>;
I'm using syn to implement a preprocessor which outputs Rust code (and needs to do some things that are hard to do with proc macros), and want it to handle shebangs the same way that Rust does. Lacking a function like the one above, this requires me to make a wholesale copy of syn's private whitespace module and an almost-wholesale copy of parse_file. Having it available would let me avoid such code duplication.