encoding_rs::mem

Function check_utf8_for_latin1_and_bidi

source
pub fn check_utf8_for_latin1_and_bidi(buffer: &[u8]) -> Latin1Bidi
Expand description

Checks whether a potentially invalid 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_utf8_latin1() would return true. Otherwise, returns Latin1Bidi::Bidi if is_utf8_bidi() would return true. Otherwise, returns Latin1Bidi::LeftToRight.