logo

Function embed_plist::get_launchd_plist[][src]

pub fn get_launchd_plist() -> &'static [u8]
Expand description

Returns the contents of the embedded launchd.plist file.

Examples

We can verify that the result is correct by checking it against the file at runtime:

embed_plist::embed_launchd_plist!("launchd.plist");

let embedded_plist = embed_plist::get_launchd_plist();
let read_plist = std::fs::read("launchd.plist")?;

assert_eq!(embedded_plist, read_plist.as_slice());

If embed_launchd_plist! has not been called, this function creates a compile-time error by failing to reference the symbol defined by that macro:

let embedded_plist = embed_plist::get_launchd_plist();

Safety

This function relies on _EMBED_LAUNCHD_PLIST being defined within the __TEXT,__launchd_plist section. You should not define this symbol outside of using the macros provided by this library.