[][src]Macro embed_plist::embed_launchd_plist

macro_rules! embed_launchd_plist {
    ($path:expr) => { ... };
}

Embeds the launchd.plist file at $path directly in the current binary.

After using this macro, you can get its content by calling get_launchd_plist from anywhere in your program.

Accidental Reuse Protection

Only one copy of launchd.plist should exist in a binary. Accidentally embedding it multiple times would break tools that read this section.

Fortunately, this library makes reuse a compile-time error! This protection works even if this macro is reused in different modules.

This example deliberately fails to compile
embed_plist::embed_launchd_plist!("launchd.plist");
embed_plist::embed_launchd_plist!("launchd.plist");

This example produces the following error:

error: symbol `_EMBED_LAUNCHD_PLIST` is already defined
 --> src/main.rs:4:1
  |
4 | embed_plist::embed_launchd_plist!("launchd.plist");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

Warning: Although the name _EMBED_LAUNCHD_PLIST can be seen here, you should not reference this symbol with e.g. an extern "C" block. I reserve the right to change this name in a SemVer-compatible update.