~repos /rust-embed

#rust#proc-macro#http

git clone https://pyrossh.dev/repos/rust-embed.git

rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.


895e611c Buckram

1 year ago
symlinks does not work in debug mode
examples/public/symlinks/main.js ADDED
@@ -0,0 +1 @@
1
+ ../main.js
tests/include_exclude.rs CHANGED
@@ -52,3 +52,15 @@ fn exclude_has_higher_priority() {
52
52
  assert!(ExcludePriorityAssets::get("images/llama.png").is_some(), "llama.png should exist");
53
53
  assert_eq!(ExcludePriorityAssets::iter().count(), 2);
54
54
  }
55
+
56
+ #[derive(RustEmbed)]
57
+ #[folder = "examples/public/symlinks"]
58
+ #[include = "main.js"]
59
+ struct IncludeSymlink;
60
+
61
+ #[test]
62
+ fn include_symlink() {
63
+ assert_eq!(IncludeSymlink::iter().count(), 1);
64
+ assert_eq!(IncludeSymlink::iter().next(), Some(std::borrow::Cow::Borrowed("main.js")));
65
+ assert!(IncludeSymlink::get("main.js").is_some())
66
+ }