~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.


527baaee BBaoVanC

2 years ago
Don't duplicate the entire __rust_embed_new function
Files changed (1) hide show
  1. utils/src/lib.rs +2 -8
utils/src/lib.rs CHANGED
@@ -93,17 +93,11 @@ pub struct Metadata {
93
93
 
94
94
  impl Metadata {
95
95
  #[doc(hidden)]
96
- #[cfg(not(feature = "mime-guess"))]
97
- pub fn __rust_embed_new(hash: [u8; 32], last_modified: Option<u64>) -> Self {
98
- Self { hash, last_modified }
99
- }
100
-
101
- #[doc(hidden)]
102
- #[cfg(feature = "mime-guess")]
103
- pub fn __rust_embed_new(hash: [u8; 32], last_modified: Option<u64>, mimetype: &'static str) -> Self {
96
+ pub fn __rust_embed_new(hash: [u8; 32], last_modified: Option<u64>, #[cfg(feature = "mime-guess")] mimetype: &'static str) -> Self {
104
97
  Self {
105
98
  hash,
106
99
  last_modified,
100
+ #[cfg(feature = "mime-guess")]
107
101
  mimetype: mimetype.into(),
108
102
  }
109
103
  }