macro_rules! buffered_string_method_with_retry {
($method_name:ident, $buffer_capacity:expr,
[$($before_arg:ident: $before_arg_type:ty,)*],
[$($after_arg:ident: $after_arg_type:ty,)*]) => { ... };
}
Expand description
Generates a method to wrap ICU4C uloc
methods that require a resizable output string buffer.
The various uloc
methods of this type have inconsistent signature patterns, with some putting
all their input arguments before the buffer
and its capacity
, and some splitting the input
arguments.
Therefore, the macro supports input arguments in both positions.
For an invocation of the form
ⓘ
buffered_string_method_with_retry!(
my_method,
BUFFER_CAPACITY,
[before_arg_a: before_type_a, before_arg_b: before_type_b,],
[after_arg_a: after_type_a, after_arg_b: after_type_b,]
);
the generated method has a signature of the form
ⓘ
fn my_method(
method_to_call: unsafe extern "C" fn(
before_type_a,
before_type_b,
*mut raw::c_char,
i32,
after_type_a,
after_type_b,
*mut sys::UErrorCode,
) -> i32,
before_arg_a: before_type_a,
before_arg_b: before_type_b,
after_arg_a: after_type_a,
after_arg_b: after_type_b
) -> Result<String, common::Error> {}