logo

Macro embed_plist::embed_info_plist[][src]

macro_rules! embed_info_plist {
    ($path : expr) => { ... };
}
Expand description

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

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

Accidental Reuse Protection

Only one copy of Info.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.

embed_plist::embed_info_plist!("Info.plist");
embed_plist::embed_info_plist!("Info.plist");

This example produces the following error:

error: symbol `_EMBED_INFO_PLIST` is already defined
 --> src/main.rs:4:1
  |
4 | embed_plist::embed_info_plist!("Info.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_INFO_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.