Skip to content

Commit 84edbfa

Browse files
committed
support pub(restricted)
1 parent a7dae2c commit 84edbfa

File tree

4 files changed

+85
-6
lines changed

4 files changed

+85
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lazy-static-include"
3-
version = "2.0.1"
3+
version = "2.1.0"
44
authors = ["Magic Len <len@magiclen.org>"]
55
repository = "https://github.com/magiclen/lazy-static-include"
66
homepage = "https://magiclen.org/lazy-static-include"

src/macro_include_array.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,11 +985,21 @@ macro_rules! lazy_static_include_array {
985985
pub static ref $name: [&'static str; $s] = lazy_static_include_array_inner!($name: [&'static str; $s], $path);
986986
}
987987
};
988+
( pub($($vis:tt)*) $name:ident: [&'static str; $s:expr], $path:expr $(,)* ) => {
989+
lazy_static! {
990+
pub($($vis)*) static ref $name: [&'static str; $s] = lazy_static_include_array_inner!($name: [&'static str; $s], $path);
991+
}
992+
};
988993
( pub $name:ident: [&'static str; $s:expr], $path:expr, $($paths:expr), + $(,)* ) => {
989994
lazy_static! {
990995
pub static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], $path $(, $paths)+);
991996
}
992997
};
998+
( pub($($vis:tt)*) $name:ident: [&'static str; $s:expr], $path:expr, $($paths:expr), + $(,)* ) => {
999+
lazy_static! {
1000+
pub($($vis)*) static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], $path $(, $paths)+);
1001+
}
1002+
};
9931003
( $name:ident: [$t:ident; $s:expr], $path:expr $(,)* ) => {
9941004
lazy_static! {
9951005
static ref $name: [$t; $s] = lazy_static_include_array_inner!($name: [$t; $s], $path);
@@ -1005,11 +1015,21 @@ macro_rules! lazy_static_include_array {
10051015
pub static ref $name: [$t; $s] = lazy_static_include_array_inner!($name: [$t; $s], $path);
10061016
}
10071017
};
1018+
( pub($($vis:tt)*) $name:ident: [$t:ident; $s:expr], $path:expr $(,)* ) => {
1019+
lazy_static! {
1020+
pub($($vis)*) static ref $name: [$t; $s] = lazy_static_include_array_inner!($name: [$t; $s], $path);
1021+
}
1022+
};
10081023
( pub $name:ident: [$t:ident; $s:expr], $path:expr, $($paths:expr), + $(,)* ) => {
10091024
lazy_static! {
10101025
pub static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], $path $(, $paths)+);
10111026
}
10121027
};
1028+
( pub($($vis:tt)*) $name:ident: [$t:ident; $s:expr], $path:expr, $($paths:expr), + $(,)* ) => {
1029+
lazy_static! {
1030+
pub($($vis)*) static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], $path $(, $paths)+);
1031+
}
1032+
};
10131033
}
10141034

10151035
#[macro_export]
@@ -1024,6 +1044,11 @@ macro_rules! lazy_static_include_array_vec {
10241044
pub static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], Vec $(, $paths)+);
10251045
}
10261046
};
1047+
( pub($($vis:tt)*) $name:ident: [&'static str; $s:expr], $($paths:expr), + $(,)* ) => {
1048+
lazy_static! {
1049+
pub($($vis)*) static ref $name: Vec<[&'static str; $s]> = lazy_static_include_array_inner!($name: [&'static str; $s], Vec $(, $paths)+);
1050+
}
1051+
};
10271052
( $name:ident: [$t:ident; $s:expr], $($paths:expr), + $(,)* ) => {
10281053
lazy_static! {
10291054
static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], Vec $(, $paths)+);
@@ -1034,4 +1059,9 @@ macro_rules! lazy_static_include_array_vec {
10341059
pub static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], Vec $(, $paths)+);
10351060
}
10361061
};
1062+
( pub($($vis:tt)*) $name:ident: [$t:ident; $s:expr], $($paths:expr), + $(,)* ) => {
1063+
lazy_static! {
1064+
pub($($vis)*) static ref $name: Vec<[$t; $s]> = lazy_static_include_array_inner!($name: [$t; $s], Vec $(, $paths)+);
1065+
}
1066+
};
10371067
}

src/macro_include_bytes.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,23 @@ macro_rules! lazy_static_include_bytes {
233233

234234
lazy_static_include_bytes_impl!($name);
235235
};
236+
( pub($($vis:tt)*) $name:ident, $path:expr $(,)* ) => {
237+
lazy_static! {
238+
pub($($vis)*) static ref $name: &'static [u8] = lazy_static_include_bytes_inner!($name, $path);
239+
}
240+
241+
lazy_static_include_bytes_impl!($name);
242+
};
236243
( pub $name:ident, $path:expr, $($paths:expr), + $(,)* ) => {
237244
lazy_static! {
238-
static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, $path $(, $paths)+);
245+
pub static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, $path $(, $paths)+);
246+
}
247+
248+
lazy_static_include_bytes_multiple_impl!($name);
249+
};
250+
( pub($($vis:tt)*) $name:ident, $path:expr, $($paths:expr), + $(,)* ) => {
251+
lazy_static! {
252+
pub($($vis)*) static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, $path $(, $paths)+);
239253
}
240254

241255
lazy_static_include_bytes_multiple_impl!($name);
@@ -253,7 +267,14 @@ macro_rules! lazy_static_include_bytes_vec {
253267
};
254268
( pub $name:ident, $($paths:expr), + $(,)* ) => {
255269
lazy_static! {
256-
static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, Vec $(, $paths)+);
270+
pub static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, Vec $(, $paths)+);
271+
}
272+
273+
lazy_static_include_bytes_multiple_impl!($name);
274+
};
275+
( pub($($vis:tt)*) $name:ident, $($paths:expr), + $(,)* ) => {
276+
lazy_static! {
277+
pub($($vis)*) static ref $name: Vec<&'static [u8]> = lazy_static_include_bytes_inner!($name, Vec $(, $paths)+);
257278
}
258279

259280
lazy_static_include_bytes_multiple_impl!($name);

src/macro_include_str.rs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,37 @@ macro_rules! lazy_static_include_str {
264264

265265
lazy_static_include_str_impl!($name);
266266
};
267+
( pub($($vis:tt)*) $name:ident, $path:expr $(,)* ) => {
268+
lazy_static! {
269+
pub($($vis)*) static ref $name: &'static str = lazy_static_include_str_inner!($name, $path);
270+
}
271+
272+
lazy_static_include_str_impl!($name);
273+
};
267274
( pub $name:ident, Vec, $($paths:expr), + $(,)* ) => {
268275
lazy_static! {
269-
static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
276+
pub static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
277+
}
278+
279+
lazy_static_include_str_multiple_impl!($name);
280+
};
281+
( pub($($vis:tt)*) $name:ident, Vec, $($paths:expr), + $(,)* ) => {
282+
lazy_static! {
283+
pub($($vis)*) static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
270284
}
271285

272286
lazy_static_include_str_multiple_impl!($name);
273287
};
274288
( pub $name:ident, $path:expr, $($paths:expr), + $(,)* ) => {
275289
lazy_static! {
276-
static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, $path $(, $paths)+);
290+
pub static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, $path $(, $paths)+);
291+
}
292+
293+
lazy_static_include_str_multiple_impl!($name);
294+
};
295+
( pub($($vis:tt)*) $name:ident, $path:expr, $($paths:expr), + $(,)* ) => {
296+
lazy_static! {
297+
pub($($vis)*) static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, $path $(, $paths)+);
277298
}
278299

279300
lazy_static_include_str_multiple_impl!($name);
@@ -291,7 +312,14 @@ macro_rules! lazy_static_include_str_vec {
291312
};
292313
( pub $name:ident, $($paths:expr), + $(,)* ) => {
293314
lazy_static! {
294-
static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
315+
pub static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
316+
}
317+
318+
lazy_static_include_str_multiple_impl!($name);
319+
};
320+
( pub($($vis:tt)*) $name:ident, $($paths:expr), + $(,)* ) => {
321+
lazy_static! {
322+
pub static ref $name: Vec<&'static str> = lazy_static_include_str_inner!($name, Vec $(, $paths)+);
295323
}
296324

297325
lazy_static_include_str_multiple_impl!($name);

0 commit comments

Comments
 (0)