#[no_mangle]
pub unsafe extern "C" fn encoding_mem_check_str_for_latin1_and_bidi(
buffer: *const u8,
len: usize,
) -> Latin1Bidi
Expand description
Checks whether a valid UTF-8 buffer contains code points that trigger right-to-left processing or is all-Latin1.
Possibly more efficient than performing the checks separately.
Returns Latin1Bidi::Latin1
if is_str_latin1()
would return true
.
Otherwise, returns Latin1Bidi::Bidi
if is_str_bidi()
would return
true
. Otherwise, returns Latin1Bidi::LeftToRight
.
§Undefined behavior
UB ensues if buffer
and buffer_len
don’t designate a valid memory block,
if buffer
is NULL
, or if the memory designated by buffer
and buffer_len
does not contain valid UTF-8. (If buffer_len
is 0
, buffer
may be bogus but
still has to be non-NULL
.)