rust_icu_sys/bindgen/
macros.rs

1// Macros for changing function names.
2// This is created and edited manually, but should be kept roughly in sync with `build.rs`.
3
4/// This library was build with version renaming, so rewrite every function name
5/// with its name with version number appended.
6
7/// The macro will rename a symbol `foo::bar` to `foo::bar_64` (where "64")
8/// may be some other number depending on the ICU library in use.
9#[cfg(all(feature = "renaming", not(feature = "icu_version_in_env")))]
10#[macro_export]
11macro_rules! versioned_function {
12    ($i:ident) => {
13      $crate::__private_do_not_use::paste::expr! {
14        $crate::[< $i _ 64 >]
15      }
16    }
17}
18
19/// This library was build with version renaming, so rewrite every function name
20/// with its name with version number appended.
21///
22/// The macro will rename a symbol `foo::bar` to `foo::bar_XX` (where "XX")
23/// is a string coming from the environment variable RUST_ICU_MAJOR_VERSION_NUMBER,
24/// which is expected to be defined at compile time.
25#[cfg(all(feature = "renaming", feature = "icu_version_in_env"))]
26#[macro_export]
27macro_rules! versioned_function {
28    ($i:ident) => {
29      $crate::__private_do_not_use::paste::expr! {
30        $crate::[< $i _ env!("RUST_ICU_MAJOR_VERSION_NUMBER") >]
31      }
32    }
33}
34
35/// This macro will be used when no function renaming is needed.
36#[cfg(not(feature = "renaming"))]
37#[macro_export]
38macro_rules! versioned_function {
39    ($func_name:ident) => {
40        $crate::$func_name
41    }
42}