Macro embed_plist::embed_launchd_plist_bytes [−][src]
macro_rules! embed_launchd_plist_bytes {
($bytes : expr) => { ... };
}
Expand description
Embeds the launchd.plist
file in &[u8]
directly in the current binary.
This enables you to have more control over what bytes are embedded into your
program. For example, you may want to do const
-compatible preprocessing
such as converting into a binary property list.
The embed_launchd_plist!
macro is a convenience wrapper around this and
include_bytes!
.
Examples
After using this macro, you can get its content by calling
get_launchd_plist
from anywhere in your program:
const PLIST: &[u8] = r#"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Why</key>
<string>To use in doc tests</string>
<key>Label</key>
<string>example</string>
<key>ProgramArguments</key>
<array>
<string>Hello</string>
<string>World</string>
</array>
</dict>
</plist>
"#.as_bytes();
embed_plist::embed_launchd_plist_bytes!(PLIST);
let embedded = embed_plist::get_launchd_plist();
assert_eq!(embedded, PLIST);