1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! The `bracket-embedding` crate is used to provide resource embedding.
//! This allows you to include binary assets inside your program when shipping,
//! with no external files. This can be especially useful for WASM builds.
//!
//! For example:
//!
//! ```rust
//! use bracket_embedding::prelude::*;
//!
//! embedded_resource!(SOURCE_FILE, "embedding.rs");
//!
//! fn main() {
//! // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
//! link_resource!(SOURCE_FILE, "embedding.rs");
//! }
//! ```
//!
//! This crate isn't very useful on its own, but is heavily used by the other parts of `bracket-lib`.
/// Declare an embedded resource.
///
/// # Arguments
///
/// * `resource_name` - a constant that will represent the resource.
/// * `filename` - the path to the file to embed.
///
/// Once embedded, you need to use `link_resource` to make it available.
///
/// # Example
///
/// ```rust
/// use bracket_embedding::prelude::*;
///
/// embedded_resource!(SOURCE_FILE, "embedding.rs");
///
/// fn main() {
/// // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
/// link_resource!(SOURCE_FILE, "embedding.rs");
/// }
/// ```
/// Link an embedded resource, making it available to `bracket-lib` via the resources
/// system.
///
/// # Arguments
///
/// * `resource_name` - a constant that will represent the resource.
/// * `filename` - the path to the file to embed.
///
/// The resource must be previously declared with `embedded_resource!`.
///
/// # Example
///
/// ```rust
/// use bracket_embedding::prelude::*;
///
/// embedded_resource!(SOURCE_FILE, "embedding.rs");
///
/// fn main() {
/// // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
/// link_resource!(SOURCE_FILE, "embedding.rs");
/// }
/// ```