Advertisement
Guest User

Untitled

a guest
Sep 8th, 2022
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.44 KB | None | 0 0
  1. pub fn preprocess(&self, src: &str) -> String {
  2.         let reg = r#"\#include\("(.+.wgsl)"\);"#;
  3.         let re = Regex::new(reg).unwrap();
  4.  
  5.         let processed = re.replace_all(src, |caps: &Captures| {
  6.             let filename = caps[1].to_owned();
  7.             let file_path = self.root.join(filename);
  8.  
  9.             let contents = fs::read_to_string(file_path).unwrap();
  10.             contents
  11.         });
  12.         processed.to_string()
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement