/* automatically generated by rust-bindgen 0.72.0 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
storage: Storage,
}
impl<Storage> __BindgenBitfieldUnit<Storage> {
#[inline]
pub const fn new(storage: Storage) -> Self {
Self { storage }
}
}
impl<Storage> __BindgenBitfieldUnit<Storage>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
fn extract_bit(byte: u8, index: usize) -> bool {
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
Self::extract_bit(byte, index)
}
#[inline]
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = unsafe { *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize) };
Self::extract_bit(byte, index)
}
#[inline]
fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val { byte | mask } else { byte & !mask }
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
*byte = Self::change_bit(*byte, index, val);
}
#[inline]
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = unsafe { (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize) };
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
#[inline]
pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}
pub type utf8proc_int8_t = i8;
pub type utf8proc_uint8_t = u8;
pub type utf8proc_int16_t = i16;
pub type utf8proc_uint16_t = u16;
pub type utf8proc_int32_t = i32;
pub type utf8proc_uint32_t = u32;
pub type utf8proc_size_t = usize;
pub type utf8proc_ssize_t = isize;
pub type utf8proc_bool = bool;
impl utf8proc_option_t {
#[doc = " The given UTF-8 input is NULL terminated."]
pub const UTF8PROC_NULLTERM: utf8proc_option_t = utf8proc_option_t(1);
#[doc = " Unicode Versioning Stability has to be respected."]
pub const UTF8PROC_STABLE: utf8proc_option_t = utf8proc_option_t(2);
#[doc = " Compatibility decomposition (i.e. formatting information is lost)."]
pub const UTF8PROC_COMPAT: utf8proc_option_t = utf8proc_option_t(4);
#[doc = " Return a result with decomposed characters."]
pub const UTF8PROC_COMPOSE: utf8proc_option_t = utf8proc_option_t(8);
#[doc = " Return a result with decomposed characters."]
pub const UTF8PROC_DECOMPOSE: utf8proc_option_t = utf8proc_option_t(16);
#[doc = " Strip \"default ignorable characters\" such as SOFT-HYPHEN or ZERO-WIDTH-SPACE."]
pub const UTF8PROC_IGNORE: utf8proc_option_t = utf8proc_option_t(32);
#[doc = " Return an error, if the input contains unassigned codepoints."]
pub const UTF8PROC_REJECTNA: utf8proc_option_t = utf8proc_option_t(64);
#[doc = " Indicating that NLF-sequences (LF, CRLF, CR, NEL) are representing a\n line break, and should be converted to the codepoint for line\n separation (LS)."]
pub const UTF8PROC_NLF2LS: utf8proc_option_t = utf8proc_option_t(128);
#[doc = " Indicating that NLF-sequences are representing a paragraph break, and\n should be converted to the codepoint for paragraph separation\n (PS)."]
pub const UTF8PROC_NLF2PS: utf8proc_option_t = utf8proc_option_t(256);
#[doc = " Indicating that the meaning of NLF-sequences is unknown."]
pub const UTF8PROC_NLF2LF: utf8proc_option_t = utf8proc_option_t(384);
#[doc = " Strips and/or convers control characters.\n\n NLF-sequences are transformed into space, except if one of the\n NLF2LS/PS/LF options is given. HorizontalTab (HT) and FormFeed (FF)\n are treated as a NLF-sequence in this case. All other control\n characters are simply removed."]
pub const UTF8PROC_STRIPCC: utf8proc_option_t = utf8proc_option_t(512);
#[doc = " Performs unicode case folding, to be able to do a case-insensitive\n string comparison."]
pub const UTF8PROC_CASEFOLD: utf8proc_option_t = utf8proc_option_t(1024);
#[doc = " Inserts 0xFF bytes at the beginning of each sequence which is\n representing a single grapheme cluster (see UAX#29)."]
pub const UTF8PROC_CHARBOUND: utf8proc_option_t = utf8proc_option_t(2048);
#[doc = " Lumps certain characters together.\n\n E.g. HYPHEN U+2010 and MINUS U+2212 to ASCII \"-\". See lump.md for details.\n\n If NLF2LF is set, this includes a transformation of paragraph and\n line separators to ASCII line-feed (LF)."]
pub const UTF8PROC_LUMP: utf8proc_option_t = utf8proc_option_t(4096);
#[doc = " Strips all character markings.\n\n This includes non-spacing, spacing and enclosing (i.e. accents).\n @note This option works only with @ref UTF8PROC_COMPOSE or\n @ref UTF8PROC_DECOMPOSE"]
pub const UTF8PROC_STRIPMARK: utf8proc_option_t = utf8proc_option_t(8192);
#[doc = " Strip unassigned codepoints."]
pub const UTF8PROC_STRIPNA: utf8proc_option_t = utf8proc_option_t(16384);
}
impl ::std::ops::BitOr<utf8proc_option_t> for utf8proc_option_t {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
utf8proc_option_t(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for utf8proc_option_t {
#[inline]
fn bitor_assign(&mut self, rhs: utf8proc_option_t) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<utf8proc_option_t> for utf8proc_option_t {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
utf8proc_option_t(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for utf8proc_option_t {
#[inline]
fn bitand_assign(&mut self, rhs: utf8proc_option_t) {
self.0 &= rhs.0;
}
}
#[repr(transparent)]
#[doc = " Option flags used by several functions in the library."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_option_t(pub ::std::os::raw::c_uint);
#[doc = " Holds the value of a property."]
pub type utf8proc_propval_t = utf8proc_int16_t;
#[doc = " Struct containing information about a codepoint."]
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Copy, Clone)]
pub struct utf8proc_property_struct {
#[doc = " Unicode category.\n @see utf8proc_category_t."]
pub category: utf8proc_propval_t,
pub combining_class: utf8proc_propval_t,
#[doc = " Bidirectional class.\n @see utf8proc_bidi_class_t."]
pub bidi_class: utf8proc_propval_t,
#[doc = " @anchor Decomposition type.\n @see utf8proc_decomp_type_t."]
pub decomp_type: utf8proc_propval_t,
pub decomp_seqindex: utf8proc_uint16_t,
pub casefold_seqindex: utf8proc_uint16_t,
pub uppercase_seqindex: utf8proc_uint16_t,
pub lowercase_seqindex: utf8proc_uint16_t,
pub titlecase_seqindex: utf8proc_uint16_t,
pub _bitfield_align_1: [u16; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
pub __bindgen_padding_0: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of utf8proc_property_struct"][::std::mem::size_of::<utf8proc_property_struct>() - 24usize];
["Alignment of utf8proc_property_struct"][::std::mem::align_of::<utf8proc_property_struct>() - 4usize];
["Offset of field: utf8proc_property_struct::category"]
[::std::mem::offset_of!(utf8proc_property_struct, category) - 0usize];
["Offset of field: utf8proc_property_struct::combining_class"]
[::std::mem::offset_of!(utf8proc_property_struct, combining_class) - 2usize];
["Offset of field: utf8proc_property_struct::bidi_class"]
[::std::mem::offset_of!(utf8proc_property_struct, bidi_class) - 4usize];
["Offset of field: utf8proc_property_struct::decomp_type"]
[::std::mem::offset_of!(utf8proc_property_struct, decomp_type) - 6usize];
["Offset of field: utf8proc_property_struct::decomp_seqindex"]
[::std::mem::offset_of!(utf8proc_property_struct, decomp_seqindex) - 8usize];
["Offset of field: utf8proc_property_struct::casefold_seqindex"]
[::std::mem::offset_of!(utf8proc_property_struct, casefold_seqindex) - 10usize];
["Offset of field: utf8proc_property_struct::uppercase_seqindex"]
[::std::mem::offset_of!(utf8proc_property_struct, uppercase_seqindex) - 12usize];
["Offset of field: utf8proc_property_struct::lowercase_seqindex"]
[::std::mem::offset_of!(utf8proc_property_struct, lowercase_seqindex) - 14usize];
["Offset of field: utf8proc_property_struct::titlecase_seqindex"]
[::std::mem::offset_of!(utf8proc_property_struct, titlecase_seqindex) - 16usize];
};
impl utf8proc_property_struct {
#[inline]
pub fn comb_index(&self) -> utf8proc_uint16_t {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 10u8) as u16) }
}
#[inline]
pub fn set_comb_index(&mut self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 10u8, val as u64)
}
}
#[inline]
pub unsafe fn comb_index_raw(this: *const Self) -> utf8proc_uint16_t {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
0usize,
10u8,
) as u16)
}
}
#[inline]
pub unsafe fn set_comb_index_raw(this: *mut Self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
0usize,
10u8,
val as u64,
)
}
}
#[inline]
pub fn comb_length(&self) -> utf8proc_uint16_t {
unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 5u8) as u16) }
}
#[inline]
pub fn set_comb_length(&mut self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
self._bitfield_1.set(10usize, 5u8, val as u64)
}
}
#[inline]
pub unsafe fn comb_length_raw(this: *const Self) -> utf8proc_uint16_t {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
10usize,
5u8,
) as u16)
}
}
#[inline]
pub unsafe fn set_comb_length_raw(this: *mut Self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
10usize,
5u8,
val as u64,
)
}
}
#[inline]
pub fn comb_issecond(&self) -> utf8proc_uint16_t {
unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u16) }
}
#[inline]
pub fn set_comb_issecond(&mut self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
self._bitfield_1.set(15usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn comb_issecond_raw(this: *const Self) -> utf8proc_uint16_t {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
15usize,
1u8,
) as u16)
}
}
#[inline]
pub unsafe fn set_comb_issecond_raw(this: *mut Self, val: utf8proc_uint16_t) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
15usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn bidi_mirrored(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) }
}
#[inline]
pub fn set_bidi_mirrored(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(16usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn bidi_mirrored_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
16usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_bidi_mirrored_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
16usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn comp_exclusion(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) }
}
#[inline]
pub fn set_comp_exclusion(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(17usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn comp_exclusion_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
17usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_comp_exclusion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
17usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn ignorable(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) }
}
#[inline]
pub fn set_ignorable(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(18usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn ignorable_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
18usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_ignorable_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
18usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn control_boundary(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u32) }
}
#[inline]
pub fn set_control_boundary(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(19usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn control_boundary_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
19usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_control_boundary_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
19usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn charwidth(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 2u8) as u32) }
}
#[inline]
pub fn set_charwidth(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(20usize, 2u8, val as u64)
}
}
#[inline]
pub unsafe fn charwidth_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
20usize,
2u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_charwidth_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
20usize,
2u8,
val as u64,
)
}
}
#[inline]
pub fn ambiguous_width(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) }
}
#[inline]
pub fn set_ambiguous_width(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(22usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn ambiguous_width_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
22usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_ambiguous_width_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
22usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn pad(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u32) }
}
#[inline]
pub fn set_pad(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(23usize, 1u8, val as u64)
}
}
#[inline]
pub unsafe fn pad_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
23usize,
1u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_pad_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
23usize,
1u8,
val as u64,
)
}
}
#[inline]
pub fn boundclass(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 6u8) as u32) }
}
#[inline]
pub fn set_boundclass(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(24usize, 6u8, val as u64)
}
}
#[inline]
pub unsafe fn boundclass_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
24usize,
6u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_boundclass_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
24usize,
6u8,
val as u64,
)
}
}
#[inline]
pub fn indic_conjunct_break(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 2u8) as u32) }
}
#[inline]
pub fn set_indic_conjunct_break(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(30usize, 2u8, val as u64)
}
}
#[inline]
pub unsafe fn indic_conjunct_break_raw(this: *const Self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_get(
::std::ptr::addr_of!((*this)._bitfield_1),
30usize,
2u8,
) as u32)
}
}
#[inline]
pub unsafe fn set_indic_conjunct_break_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
<__BindgenBitfieldUnit<[u8; 4usize]>>::raw_set(
::std::ptr::addr_of_mut!((*this)._bitfield_1),
30usize,
2u8,
val as u64,
)
}
}
#[inline]
pub fn new_bitfield_1(
comb_index: utf8proc_uint16_t,
comb_length: utf8proc_uint16_t,
comb_issecond: utf8proc_uint16_t,
bidi_mirrored: ::std::os::raw::c_uint,
comp_exclusion: ::std::os::raw::c_uint,
ignorable: ::std::os::raw::c_uint,
control_boundary: ::std::os::raw::c_uint,
charwidth: ::std::os::raw::c_uint,
ambiguous_width: ::std::os::raw::c_uint,
pad: ::std::os::raw::c_uint,
boundclass: ::std::os::raw::c_uint,
indic_conjunct_break: ::std::os::raw::c_uint,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 10u8, {
let comb_index: u16 = unsafe { ::std::mem::transmute(comb_index) };
comb_index as u64
});
__bindgen_bitfield_unit.set(10usize, 5u8, {
let comb_length: u16 = unsafe { ::std::mem::transmute(comb_length) };
comb_length as u64
});
__bindgen_bitfield_unit.set(15usize, 1u8, {
let comb_issecond: u16 = unsafe { ::std::mem::transmute(comb_issecond) };
comb_issecond as u64
});
__bindgen_bitfield_unit.set(16usize, 1u8, {
let bidi_mirrored: u32 = unsafe { ::std::mem::transmute(bidi_mirrored) };
bidi_mirrored as u64
});
__bindgen_bitfield_unit.set(17usize, 1u8, {
let comp_exclusion: u32 = unsafe { ::std::mem::transmute(comp_exclusion) };
comp_exclusion as u64
});
__bindgen_bitfield_unit.set(18usize, 1u8, {
let ignorable: u32 = unsafe { ::std::mem::transmute(ignorable) };
ignorable as u64
});
__bindgen_bitfield_unit.set(19usize, 1u8, {
let control_boundary: u32 = unsafe { ::std::mem::transmute(control_boundary) };
control_boundary as u64
});
__bindgen_bitfield_unit.set(20usize, 2u8, {
let charwidth: u32 = unsafe { ::std::mem::transmute(charwidth) };
charwidth as u64
});
__bindgen_bitfield_unit.set(22usize, 1u8, {
let ambiguous_width: u32 = unsafe { ::std::mem::transmute(ambiguous_width) };
ambiguous_width as u64
});
__bindgen_bitfield_unit.set(23usize, 1u8, {
let pad: u32 = unsafe { ::std::mem::transmute(pad) };
pad as u64
});
__bindgen_bitfield_unit.set(24usize, 6u8, {
let boundclass: u32 = unsafe { ::std::mem::transmute(boundclass) };
boundclass as u64
});
__bindgen_bitfield_unit.set(30usize, 2u8, {
let indic_conjunct_break: u32 = unsafe { ::std::mem::transmute(indic_conjunct_break) };
indic_conjunct_break as u64
});
__bindgen_bitfield_unit
}
}
#[doc = " Struct containing information about a codepoint."]
pub type utf8proc_property_t = utf8proc_property_struct;
impl utf8proc_category_t {
#[doc = "< Other, not assigned"]
pub const UTF8PROC_CATEGORY_CN: utf8proc_category_t = utf8proc_category_t(0);
#[doc = "< Letter, uppercase"]
pub const UTF8PROC_CATEGORY_LU: utf8proc_category_t = utf8proc_category_t(1);
#[doc = "< Letter, lowercase"]
pub const UTF8PROC_CATEGORY_LL: utf8proc_category_t = utf8proc_category_t(2);
#[doc = "< Letter, titlecase"]
pub const UTF8PROC_CATEGORY_LT: utf8proc_category_t = utf8proc_category_t(3);
#[doc = "< Letter, modifier"]
pub const UTF8PROC_CATEGORY_LM: utf8proc_category_t = utf8proc_category_t(4);
#[doc = "< Letter, other"]
pub const UTF8PROC_CATEGORY_LO: utf8proc_category_t = utf8proc_category_t(5);
#[doc = "< Mark, nonspacing"]
pub const UTF8PROC_CATEGORY_MN: utf8proc_category_t = utf8proc_category_t(6);
#[doc = "< Mark, spacing combining"]
pub const UTF8PROC_CATEGORY_MC: utf8proc_category_t = utf8proc_category_t(7);
#[doc = "< Mark, enclosing"]
pub const UTF8PROC_CATEGORY_ME: utf8proc_category_t = utf8proc_category_t(8);
#[doc = "< Number, decimal digit"]
pub const UTF8PROC_CATEGORY_ND: utf8proc_category_t = utf8proc_category_t(9);
#[doc = "< Number, letter"]
pub const UTF8PROC_CATEGORY_NL: utf8proc_category_t = utf8proc_category_t(10);
#[doc = "< Number, other"]
pub const UTF8PROC_CATEGORY_NO: utf8proc_category_t = utf8proc_category_t(11);
#[doc = "< Punctuation, connector"]
pub const UTF8PROC_CATEGORY_PC: utf8proc_category_t = utf8proc_category_t(12);
#[doc = "< Punctuation, dash"]
pub const UTF8PROC_CATEGORY_PD: utf8proc_category_t = utf8proc_category_t(13);
#[doc = "< Punctuation, open"]
pub const UTF8PROC_CATEGORY_PS: utf8proc_category_t = utf8proc_category_t(14);
#[doc = "< Punctuation, close"]
pub const UTF8PROC_CATEGORY_PE: utf8proc_category_t = utf8proc_category_t(15);
#[doc = "< Punctuation, initial quote"]
pub const UTF8PROC_CATEGORY_PI: utf8proc_category_t = utf8proc_category_t(16);
#[doc = "< Punctuation, final quote"]
pub const UTF8PROC_CATEGORY_PF: utf8proc_category_t = utf8proc_category_t(17);
#[doc = "< Punctuation, other"]
pub const UTF8PROC_CATEGORY_PO: utf8proc_category_t = utf8proc_category_t(18);
#[doc = "< Symbol, math"]
pub const UTF8PROC_CATEGORY_SM: utf8proc_category_t = utf8proc_category_t(19);
#[doc = "< Symbol, currency"]
pub const UTF8PROC_CATEGORY_SC: utf8proc_category_t = utf8proc_category_t(20);
#[doc = "< Symbol, modifier"]
pub const UTF8PROC_CATEGORY_SK: utf8proc_category_t = utf8proc_category_t(21);
#[doc = "< Symbol, other"]
pub const UTF8PROC_CATEGORY_SO: utf8proc_category_t = utf8proc_category_t(22);
#[doc = "< Separator, space"]
pub const UTF8PROC_CATEGORY_ZS: utf8proc_category_t = utf8proc_category_t(23);
#[doc = "< Separator, line"]
pub const UTF8PROC_CATEGORY_ZL: utf8proc_category_t = utf8proc_category_t(24);
#[doc = "< Separator, paragraph"]
pub const UTF8PROC_CATEGORY_ZP: utf8proc_category_t = utf8proc_category_t(25);
#[doc = "< Other, control"]
pub const UTF8PROC_CATEGORY_CC: utf8proc_category_t = utf8proc_category_t(26);
#[doc = "< Other, format"]
pub const UTF8PROC_CATEGORY_CF: utf8proc_category_t = utf8proc_category_t(27);
#[doc = "< Other, surrogate"]
pub const UTF8PROC_CATEGORY_CS: utf8proc_category_t = utf8proc_category_t(28);
#[doc = "< Other, private use"]
pub const UTF8PROC_CATEGORY_CO: utf8proc_category_t = utf8proc_category_t(29);
}
#[repr(transparent)]
#[doc = " Unicode categories."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_category_t(pub ::std::os::raw::c_uint);
impl utf8proc_bidi_class_t {
#[doc = "< Left-to-Right"]
pub const UTF8PROC_BIDI_CLASS_L: utf8proc_bidi_class_t = utf8proc_bidi_class_t(1);
#[doc = "< Left-to-Right Embedding"]
pub const UTF8PROC_BIDI_CLASS_LRE: utf8proc_bidi_class_t = utf8proc_bidi_class_t(2);
#[doc = "< Left-to-Right Override"]
pub const UTF8PROC_BIDI_CLASS_LRO: utf8proc_bidi_class_t = utf8proc_bidi_class_t(3);
#[doc = "< Right-to-Left"]
pub const UTF8PROC_BIDI_CLASS_R: utf8proc_bidi_class_t = utf8proc_bidi_class_t(4);
#[doc = "< Right-to-Left Arabic"]
pub const UTF8PROC_BIDI_CLASS_AL: utf8proc_bidi_class_t = utf8proc_bidi_class_t(5);
#[doc = "< Right-to-Left Embedding"]
pub const UTF8PROC_BIDI_CLASS_RLE: utf8proc_bidi_class_t = utf8proc_bidi_class_t(6);
#[doc = "< Right-to-Left Override"]
pub const UTF8PROC_BIDI_CLASS_RLO: utf8proc_bidi_class_t = utf8proc_bidi_class_t(7);
#[doc = "< Pop Directional Format"]
pub const UTF8PROC_BIDI_CLASS_PDF: utf8proc_bidi_class_t = utf8proc_bidi_class_t(8);
#[doc = "< European Number"]
pub const UTF8PROC_BIDI_CLASS_EN: utf8proc_bidi_class_t = utf8proc_bidi_class_t(9);
#[doc = "< European Separator"]
pub const UTF8PROC_BIDI_CLASS_ES: utf8proc_bidi_class_t = utf8proc_bidi_class_t(10);
#[doc = "< European Number Terminator"]
pub const UTF8PROC_BIDI_CLASS_ET: utf8proc_bidi_class_t = utf8proc_bidi_class_t(11);
#[doc = "< Arabic Number"]
pub const UTF8PROC_BIDI_CLASS_AN: utf8proc_bidi_class_t = utf8proc_bidi_class_t(12);
#[doc = "< Common Number Separator"]
pub const UTF8PROC_BIDI_CLASS_CS: utf8proc_bidi_class_t = utf8proc_bidi_class_t(13);
#[doc = "< Nonspacing Mark"]
pub const UTF8PROC_BIDI_CLASS_NSM: utf8proc_bidi_class_t = utf8proc_bidi_class_t(14);
#[doc = "< Boundary Neutral"]
pub const UTF8PROC_BIDI_CLASS_BN: utf8proc_bidi_class_t = utf8proc_bidi_class_t(15);
#[doc = "< Paragraph Separator"]
pub const UTF8PROC_BIDI_CLASS_B: utf8proc_bidi_class_t = utf8proc_bidi_class_t(16);
#[doc = "< Segment Separator"]
pub const UTF8PROC_BIDI_CLASS_S: utf8proc_bidi_class_t = utf8proc_bidi_class_t(17);
#[doc = "< Whitespace"]
pub const UTF8PROC_BIDI_CLASS_WS: utf8proc_bidi_class_t = utf8proc_bidi_class_t(18);
#[doc = "< Other Neutrals"]
pub const UTF8PROC_BIDI_CLASS_ON: utf8proc_bidi_class_t = utf8proc_bidi_class_t(19);
#[doc = "< Left-to-Right Isolate"]
pub const UTF8PROC_BIDI_CLASS_LRI: utf8proc_bidi_class_t = utf8proc_bidi_class_t(20);
#[doc = "< Right-to-Left Isolate"]
pub const UTF8PROC_BIDI_CLASS_RLI: utf8proc_bidi_class_t = utf8proc_bidi_class_t(21);
#[doc = "< First Strong Isolate"]
pub const UTF8PROC_BIDI_CLASS_FSI: utf8proc_bidi_class_t = utf8proc_bidi_class_t(22);
#[doc = "< Pop Directional Isolate"]
pub const UTF8PROC_BIDI_CLASS_PDI: utf8proc_bidi_class_t = utf8proc_bidi_class_t(23);
}
#[repr(transparent)]
#[doc = " Bidirectional character classes."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_bidi_class_t(pub ::std::os::raw::c_uint);
impl utf8proc_decomp_type_t {
#[doc = "< Font"]
pub const UTF8PROC_DECOMP_TYPE_FONT: utf8proc_decomp_type_t = utf8proc_decomp_type_t(1);
#[doc = "< Nobreak"]
pub const UTF8PROC_DECOMP_TYPE_NOBREAK: utf8proc_decomp_type_t = utf8proc_decomp_type_t(2);
#[doc = "< Initial"]
pub const UTF8PROC_DECOMP_TYPE_INITIAL: utf8proc_decomp_type_t = utf8proc_decomp_type_t(3);
#[doc = "< Medial"]
pub const UTF8PROC_DECOMP_TYPE_MEDIAL: utf8proc_decomp_type_t = utf8proc_decomp_type_t(4);
#[doc = "< Final"]
pub const UTF8PROC_DECOMP_TYPE_FINAL: utf8proc_decomp_type_t = utf8proc_decomp_type_t(5);
#[doc = "< Isolated"]
pub const UTF8PROC_DECOMP_TYPE_ISOLATED: utf8proc_decomp_type_t = utf8proc_decomp_type_t(6);
#[doc = "< Circle"]
pub const UTF8PROC_DECOMP_TYPE_CIRCLE: utf8proc_decomp_type_t = utf8proc_decomp_type_t(7);
#[doc = "< Super"]
pub const UTF8PROC_DECOMP_TYPE_SUPER: utf8proc_decomp_type_t = utf8proc_decomp_type_t(8);
#[doc = "< Sub"]
pub const UTF8PROC_DECOMP_TYPE_SUB: utf8proc_decomp_type_t = utf8proc_decomp_type_t(9);
#[doc = "< Vertical"]
pub const UTF8PROC_DECOMP_TYPE_VERTICAL: utf8proc_decomp_type_t = utf8proc_decomp_type_t(10);
#[doc = "< Wide"]
pub const UTF8PROC_DECOMP_TYPE_WIDE: utf8proc_decomp_type_t = utf8proc_decomp_type_t(11);
#[doc = "< Narrow"]
pub const UTF8PROC_DECOMP_TYPE_NARROW: utf8proc_decomp_type_t = utf8proc_decomp_type_t(12);
#[doc = "< Small"]
pub const UTF8PROC_DECOMP_TYPE_SMALL: utf8proc_decomp_type_t = utf8proc_decomp_type_t(13);
#[doc = "< Square"]
pub const UTF8PROC_DECOMP_TYPE_SQUARE: utf8proc_decomp_type_t = utf8proc_decomp_type_t(14);
#[doc = "< Fraction"]
pub const UTF8PROC_DECOMP_TYPE_FRACTION: utf8proc_decomp_type_t = utf8proc_decomp_type_t(15);
#[doc = "< Compat"]
pub const UTF8PROC_DECOMP_TYPE_COMPAT: utf8proc_decomp_type_t = utf8proc_decomp_type_t(16);
}
#[repr(transparent)]
#[doc = " Decomposition type."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_decomp_type_t(pub ::std::os::raw::c_uint);
impl utf8proc_boundclass_t {
#[doc = "< Start"]
pub const UTF8PROC_BOUNDCLASS_START: utf8proc_boundclass_t = utf8proc_boundclass_t(0);
#[doc = "< Other"]
pub const UTF8PROC_BOUNDCLASS_OTHER: utf8proc_boundclass_t = utf8proc_boundclass_t(1);
#[doc = "< Cr"]
pub const UTF8PROC_BOUNDCLASS_CR: utf8proc_boundclass_t = utf8proc_boundclass_t(2);
#[doc = "< Lf"]
pub const UTF8PROC_BOUNDCLASS_LF: utf8proc_boundclass_t = utf8proc_boundclass_t(3);
#[doc = "< Control"]
pub const UTF8PROC_BOUNDCLASS_CONTROL: utf8proc_boundclass_t = utf8proc_boundclass_t(4);
#[doc = "< Extend"]
pub const UTF8PROC_BOUNDCLASS_EXTEND: utf8proc_boundclass_t = utf8proc_boundclass_t(5);
#[doc = "< L"]
pub const UTF8PROC_BOUNDCLASS_L: utf8proc_boundclass_t = utf8proc_boundclass_t(6);
#[doc = "< V"]
pub const UTF8PROC_BOUNDCLASS_V: utf8proc_boundclass_t = utf8proc_boundclass_t(7);
#[doc = "< T"]
pub const UTF8PROC_BOUNDCLASS_T: utf8proc_boundclass_t = utf8proc_boundclass_t(8);
#[doc = "< Lv"]
pub const UTF8PROC_BOUNDCLASS_LV: utf8proc_boundclass_t = utf8proc_boundclass_t(9);
#[doc = "< Lvt"]
pub const UTF8PROC_BOUNDCLASS_LVT: utf8proc_boundclass_t = utf8proc_boundclass_t(10);
#[doc = "< Regional indicator"]
pub const UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR: utf8proc_boundclass_t = utf8proc_boundclass_t(11);
#[doc = "< Spacingmark"]
pub const UTF8PROC_BOUNDCLASS_SPACINGMARK: utf8proc_boundclass_t = utf8proc_boundclass_t(12);
#[doc = "< Prepend"]
pub const UTF8PROC_BOUNDCLASS_PREPEND: utf8proc_boundclass_t = utf8proc_boundclass_t(13);
#[doc = "< Zero Width Joiner"]
pub const UTF8PROC_BOUNDCLASS_ZWJ: utf8proc_boundclass_t = utf8proc_boundclass_t(14);
#[doc = "< Emoji Base"]
pub const UTF8PROC_BOUNDCLASS_E_BASE: utf8proc_boundclass_t = utf8proc_boundclass_t(15);
#[doc = "< Emoji Modifier"]
pub const UTF8PROC_BOUNDCLASS_E_MODIFIER: utf8proc_boundclass_t = utf8proc_boundclass_t(16);
#[doc = "< Glue_After_ZWJ"]
pub const UTF8PROC_BOUNDCLASS_GLUE_AFTER_ZWJ: utf8proc_boundclass_t = utf8proc_boundclass_t(17);
#[doc = "< E_BASE + GLUE_AFTER_ZJW"]
pub const UTF8PROC_BOUNDCLASS_E_BASE_GAZ: utf8proc_boundclass_t = utf8proc_boundclass_t(18);
pub const UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC: utf8proc_boundclass_t = utf8proc_boundclass_t(19);
pub const UTF8PROC_BOUNDCLASS_E_ZWG: utf8proc_boundclass_t = utf8proc_boundclass_t(20);
}
#[repr(transparent)]
#[doc = " Boundclass property. (TR29)"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_boundclass_t(pub ::std::os::raw::c_uint);
impl utf8proc_indic_conjunct_break_t {
pub const UTF8PROC_INDIC_CONJUNCT_BREAK_NONE: utf8proc_indic_conjunct_break_t = utf8proc_indic_conjunct_break_t(0);
pub const UTF8PROC_INDIC_CONJUNCT_BREAK_LINKER: utf8proc_indic_conjunct_break_t =
utf8proc_indic_conjunct_break_t(1);
pub const UTF8PROC_INDIC_CONJUNCT_BREAK_CONSONANT: utf8proc_indic_conjunct_break_t =
utf8proc_indic_conjunct_break_t(2);
pub const UTF8PROC_INDIC_CONJUNCT_BREAK_EXTEND: utf8proc_indic_conjunct_break_t =
utf8proc_indic_conjunct_break_t(3);
}
#[repr(transparent)]
#[doc = " Indic_Conjunct_Break property. (TR44)"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct utf8proc_indic_conjunct_break_t(pub ::std::os::raw::c_uint);
#[doc = " Function pointer type passed to utf8proc_map_custom() and\n utf8proc_decompose_custom(), which is used to specify a user-defined\n mapping of codepoints to be applied in conjunction with other mappings."]
pub type utf8proc_custom_func = ::std::option::Option<
unsafe extern "C" fn(codepoint: utf8proc_int32_t, data: *mut ::std::os::raw::c_void) -> utf8proc_int32_t,
>;
unsafe extern "C" {
#[doc = " Array containing the byte lengths of a UTF-8 encoded codepoint based\n on the first byte."]
pub static utf8proc_utf8class: [utf8proc_int8_t; 256usize];
}
unsafe extern "C" {
#[doc = " Returns the utf8proc API version as a string MAJOR.MINOR.PATCH\n (http://semver.org format), possibly with a \"-dev\" suffix for\n development versions."]
pub fn utf8proc_version() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Returns the utf8proc supported Unicode version as a string MAJOR.MINOR.PATCH."]
pub fn utf8proc_unicode_version() -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Returns an informative error string for the given utf8proc error code\n (e.g. the error codes returned by utf8proc_map())."]
pub fn utf8proc_errmsg(errcode: utf8proc_ssize_t) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Reads a single codepoint from the UTF-8 sequence being pointed to by `str`.\n The maximum number of bytes read is `strlen`, unless `strlen` is\n negative (in which case up to 4 bytes are read).\n\n If a valid codepoint could be read, it is stored in the variable\n pointed to by `codepoint_ref`, otherwise that variable will be set to -1.\n In case of success, the number of bytes read is returned; otherwise, a\n negative error code is returned."]
pub fn utf8proc_iterate(
str_: *const utf8proc_uint8_t,
strlen: utf8proc_ssize_t,
codepoint_ref: *mut utf8proc_int32_t,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Check if a codepoint is valid (regardless of whether it has been\n assigned a value by the current Unicode standard).\n\n @return 1 if the given `codepoint` is valid and otherwise return 0."]
pub fn utf8proc_codepoint_valid(codepoint: utf8proc_int32_t) -> utf8proc_bool;
}
unsafe extern "C" {
#[doc = " Encodes the codepoint as an UTF-8 string in the byte array pointed\n to by `dst`. This array must be at least 4 bytes long.\n\n In case of success the number of bytes written is returned, and\n otherwise 0 is returned.\n\n This function does not check whether `codepoint` is valid Unicode."]
pub fn utf8proc_encode_char(codepoint: utf8proc_int32_t, dst: *mut utf8proc_uint8_t) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Look up the properties for a given codepoint.\n\n @param codepoint The Unicode codepoint.\n\n @returns\n A pointer to a (constant) struct containing information about\n the codepoint.\n @par\n If the codepoint is unassigned or invalid, a pointer to a special struct is\n returned in which `category` is 0 (@ref UTF8PROC_CATEGORY_CN)."]
pub fn utf8proc_get_property(codepoint: utf8proc_int32_t) -> *const utf8proc_property_t;
}
unsafe extern "C" {
#[doc = " Decompose a codepoint into an array of codepoints.\n\n @param codepoint the codepoint.\n @param dst the destination buffer.\n @param bufsize the size of the destination buffer.\n @param options one or more of the following flags:\n - @ref UTF8PROC_REJECTNA - return an error `codepoint` is unassigned\n - @ref UTF8PROC_IGNORE - strip \"default ignorable\" codepoints\n - @ref UTF8PROC_CASEFOLD - apply Unicode casefolding\n - @ref UTF8PROC_COMPAT - replace certain codepoints with their\n compatibility decomposition\n - @ref UTF8PROC_CHARBOUND - insert 0xFF bytes before each grapheme cluster\n - @ref UTF8PROC_LUMP - lump certain different codepoints together\n - @ref UTF8PROC_STRIPMARK - remove all character marks\n - @ref UTF8PROC_STRIPNA - remove unassigned codepoints\n @param last_boundclass\n Pointer to an integer variable containing\n the previous codepoint's (boundclass + indic_conjunct_break << 1) if the @ref UTF8PROC_CHARBOUND\n option is used. If the string is being processed in order, this can be initialized to 0 for\n the beginning of the string, and is thereafter updated automatically. Otherwise, this parameter is ignored.\n\n @return\n In case of success, the number of codepoints written is returned; in case\n of an error, a negative error code is returned (utf8proc_errmsg()).\n @par\n If the number of written codepoints would be bigger than `bufsize`, the\n required buffer size is returned, while the buffer will be overwritten with\n undefined data."]
pub fn utf8proc_decompose_char(
codepoint: utf8proc_int32_t,
dst: *mut utf8proc_int32_t,
bufsize: utf8proc_ssize_t,
options: utf8proc_option_t,
last_boundclass: *mut ::std::os::raw::c_int,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " The same as utf8proc_decompose_char(), but acts on a whole UTF-8\n string and orders the decomposed sequences correctly.\n\n If the @ref UTF8PROC_NULLTERM flag in `options` is set, processing\n will be stopped, when a NULL byte is encountered, otherwise `strlen`\n bytes are processed. The result (in the form of 32-bit unicode\n codepoints) is written into the buffer being pointed to by\n `buffer` (which must contain at least `bufsize` entries). In case of\n success, the number of codepoints written is returned; in case of an\n error, a negative error code is returned (utf8proc_errmsg()).\n See utf8proc_decompose_custom() to supply additional transformations.\n\n If the number of written codepoints would be bigger than `bufsize`, the\n required buffer size is returned, while the buffer will be overwritten with\n undefined data."]
pub fn utf8proc_decompose(
str_: *const utf8proc_uint8_t,
strlen: utf8proc_ssize_t,
buffer: *mut utf8proc_int32_t,
bufsize: utf8proc_ssize_t,
options: utf8proc_option_t,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " The same as utf8proc_decompose(), but also takes a `custom_func` mapping function\n that is called on each codepoint in `str` before any other transformations\n (along with a `custom_data` pointer that is passed through to `custom_func`).\n The `custom_func` argument is ignored if it is `NULL`. See also utf8proc_map_custom()."]
pub fn utf8proc_decompose_custom(
str_: *const utf8proc_uint8_t,
strlen: utf8proc_ssize_t,
buffer: *mut utf8proc_int32_t,
bufsize: utf8proc_ssize_t,
options: utf8proc_option_t,
custom_func: utf8proc_custom_func,
custom_data: *mut ::std::os::raw::c_void,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Normalizes the sequence of `length` codepoints pointed to by `buffer`\n in-place (i.e., the result is also stored in `buffer`).\n\n @param buffer the (native-endian UTF-32) unicode codepoints to re-encode.\n @param length the length (in codepoints) of the buffer.\n @param options a bitwise or (`|`) of one or more of the following flags:\n - @ref UTF8PROC_NLF2LS - convert LF, CRLF, CR and NEL into LS\n - @ref UTF8PROC_NLF2PS - convert LF, CRLF, CR and NEL into PS\n - @ref UTF8PROC_NLF2LF - convert LF, CRLF, CR and NEL into LF\n - @ref UTF8PROC_STRIPCC - strip or convert all non-affected control characters\n - @ref UTF8PROC_COMPOSE - try to combine decomposed codepoints into composite\n codepoints\n - @ref UTF8PROC_STABLE - prohibit combining characters that would violate\n the unicode versioning stability\n\n @return\n In case of success, the length (in codepoints) of the normalized UTF-32 string is\n returned; otherwise, a negative error code is returned (utf8proc_errmsg()).\n\n @warning The entries of the array pointed to by `str` have to be in the\n range `0x0000` to `0x10FFFF`. Otherwise, the program might crash!"]
pub fn utf8proc_normalize_utf32(
buffer: *mut utf8proc_int32_t,
length: utf8proc_ssize_t,
options: utf8proc_option_t,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Reencodes the sequence of `length` codepoints pointed to by `buffer`\n UTF-8 data in-place (i.e., the result is also stored in `buffer`).\n Can optionally normalize the UTF-32 sequence prior to UTF-8 conversion.\n\n @param buffer the (native-endian UTF-32) unicode codepoints to re-encode.\n @param length the length (in codepoints) of the buffer.\n @param options a bitwise or (`|`) of one or more of the following flags:\n - @ref UTF8PROC_NLF2LS - convert LF, CRLF, CR and NEL into LS\n - @ref UTF8PROC_NLF2PS - convert LF, CRLF, CR and NEL into PS\n - @ref UTF8PROC_NLF2LF - convert LF, CRLF, CR and NEL into LF\n - @ref UTF8PROC_STRIPCC - strip or convert all non-affected control characters\n - @ref UTF8PROC_COMPOSE - try to combine decomposed codepoints into composite\n codepoints\n - @ref UTF8PROC_STABLE - prohibit combining characters that would violate\n the unicode versioning stability\n - @ref UTF8PROC_CHARBOUND - insert 0xFF bytes before each grapheme cluster\n\n @return\n In case of success, the length (in bytes) of the resulting nul-terminated\n UTF-8 string is returned; otherwise, a negative error code is returned\n (utf8proc_errmsg()).\n\n @warning The amount of free space pointed to by `buffer` must\n exceed the amount of the input data by one byte, and the\n entries of the array pointed to by `str` have to be in the\n range `0x0000` to `0x10FFFF`. Otherwise, the program might crash!"]
pub fn utf8proc_reencode(
buffer: *mut utf8proc_int32_t,
length: utf8proc_ssize_t,
options: utf8proc_option_t,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Given a pair of consecutive codepoints, return whether a grapheme break is\n permitted between them (as defined by the extended grapheme clusters in UAX#29).\n\n @param codepoint1 The first codepoint.\n @param codepoint2 The second codepoint, occurring consecutively after `codepoint1`.\n @param state Beginning with Version 29 (Unicode 9.0.0), this algorithm requires\n state to break graphemes. This state can be passed in as a pointer\n in the `state` argument and should initially be set to 0. If the\n state is not passed in (i.e. a null pointer is passed), UAX#29 rules\n GB10/12/13 which require this state will not be applied, essentially\n matching the rules in Unicode 8.0.0.\n\n @warning If the state parameter is used, `utf8proc_grapheme_break_stateful` must\n be called IN ORDER on ALL potential breaks in a string. However, it\n is safe to reset the state to zero after a grapheme break."]
pub fn utf8proc_grapheme_break_stateful(
codepoint1: utf8proc_int32_t,
codepoint2: utf8proc_int32_t,
state: *mut utf8proc_int32_t,
) -> utf8proc_bool;
}
unsafe extern "C" {
#[doc = " Same as utf8proc_grapheme_break_stateful(), except without support for the\n Unicode 9 additions to the algorithm. Supported for legacy reasons."]
pub fn utf8proc_grapheme_break(codepoint1: utf8proc_int32_t, codepoint2: utf8proc_int32_t) -> utf8proc_bool;
}
unsafe extern "C" {
#[doc = " Given a codepoint `c`, return the codepoint of the corresponding\n lower-case character, if any; otherwise (if there is no lower-case\n variant, or if `c` is not a valid codepoint) return `c`."]
pub fn utf8proc_tolower(c: utf8proc_int32_t) -> utf8proc_int32_t;
}
unsafe extern "C" {
#[doc = " Given a codepoint `c`, return the codepoint of the corresponding\n upper-case character, if any; otherwise (if there is no upper-case\n variant, or if `c` is not a valid codepoint) return `c`."]
pub fn utf8proc_toupper(c: utf8proc_int32_t) -> utf8proc_int32_t;
}
unsafe extern "C" {
#[doc = " Given a codepoint `c`, return the codepoint of the corresponding\n title-case character, if any; otherwise (if there is no title-case\n variant, or if `c` is not a valid codepoint) return `c`."]
pub fn utf8proc_totitle(c: utf8proc_int32_t) -> utf8proc_int32_t;
}
unsafe extern "C" {
#[doc = " Given a codepoint `c`, return `1` if the codepoint corresponds to a lower-case character\n and `0` otherwise."]
pub fn utf8proc_islower(c: utf8proc_int32_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
#[doc = " Given a codepoint `c`, return `1` if the codepoint corresponds to an upper-case character\n and `0` otherwise."]
pub fn utf8proc_isupper(c: utf8proc_int32_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
#[doc = " Given a codepoint, return a character width analogous to `wcwidth(codepoint)`,\n except that a width of 0 is returned for non-printable codepoints\n instead of -1 as in `wcwidth`.\n\n @note\n If you want to check for particular types of non-printable characters,\n (analogous to `isprint` or `iscntrl`), use utf8proc_category()."]
pub fn utf8proc_charwidth(codepoint: utf8proc_int32_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
#[doc = " Given a codepoint, return whether it has East Asian width class A (Ambiguous)\n\n Codepoints with this property are considered to have charwidth 1 (if they are printable)\n but some East Asian fonts render them as double width."]
pub fn utf8proc_charwidth_ambiguous(codepoint: utf8proc_int32_t) -> utf8proc_bool;
}
unsafe extern "C" {
#[doc = " Return the Unicode category for the codepoint (one of the\n @ref utf8proc_category_t constants.)"]
pub fn utf8proc_category(codepoint: utf8proc_int32_t) -> utf8proc_category_t;
}
unsafe extern "C" {
#[doc = " Return the two-letter (nul-terminated) Unicode category string for\n the codepoint (e.g. `\"Lu\"` or `\"Co\"`)."]
pub fn utf8proc_category_string(codepoint: utf8proc_int32_t) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Maps the given UTF-8 string pointed to by `str` to a new UTF-8\n string, allocated dynamically by `malloc` and returned via `dstptr`.\n\n If the @ref UTF8PROC_NULLTERM flag in the `options` field is set,\n the length is determined by a NULL terminator, otherwise the\n parameter `strlen` is evaluated to determine the string length, but\n in any case the result will be NULL terminated (though it might\n contain NULL characters with the string if `str` contained NULL\n characters). Other flags in the `options` field are passed to the\n functions defined above, and regarded as described. See also\n utf8proc_map_custom() to supply a custom codepoint transformation.\n\n In case of success the length of the new string is returned,\n otherwise a negative error code is returned.\n\n @note The memory of the new UTF-8 string will have been allocated\n with `malloc`, and should therefore be deallocated with `free`."]
pub fn utf8proc_map(
str_: *const utf8proc_uint8_t,
strlen: utf8proc_ssize_t,
dstptr: *mut *mut utf8proc_uint8_t,
options: utf8proc_option_t,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " Like utf8proc_map(), but also takes a `custom_func` mapping function\n that is called on each codepoint in `str` before any other transformations\n (along with a `custom_data` pointer that is passed through to `custom_func`).\n The `custom_func` argument is ignored if it is `NULL`."]
pub fn utf8proc_map_custom(
str_: *const utf8proc_uint8_t,
strlen: utf8proc_ssize_t,
dstptr: *mut *mut utf8proc_uint8_t,
options: utf8proc_option_t,
custom_func: utf8proc_custom_func,
custom_data: *mut ::std::os::raw::c_void,
) -> utf8proc_ssize_t;
}
unsafe extern "C" {
#[doc = " @name Unicode normalization\n\n Returns a pointer to newly allocated memory of a NFD, NFC, NFKD, NFKC or\n NFKC_Casefold normalized version of the null-terminated string `str`. These\n are shortcuts to calling utf8proc_map() with @ref UTF8PROC_NULLTERM\n combined with @ref UTF8PROC_STABLE and flags indicating the normalization.\n/\n/** @{ */\n/** NFD normalization (@ref UTF8PROC_DECOMPOSE)."]
pub fn utf8proc_NFD(str_: *const utf8proc_uint8_t) -> *mut utf8proc_uint8_t;
}
unsafe extern "C" {
#[doc = " NFC normalization (@ref UTF8PROC_COMPOSE)."]
pub fn utf8proc_NFC(str_: *const utf8proc_uint8_t) -> *mut utf8proc_uint8_t;
}
unsafe extern "C" {
#[doc = " NFKD normalization (@ref UTF8PROC_DECOMPOSE and @ref UTF8PROC_COMPAT)."]
pub fn utf8proc_NFKD(str_: *const utf8proc_uint8_t) -> *mut utf8proc_uint8_t;
}
unsafe extern "C" {
#[doc = " NFKC normalization (@ref UTF8PROC_COMPOSE and @ref UTF8PROC_COMPAT)."]
pub fn utf8proc_NFKC(str_: *const utf8proc_uint8_t) -> *mut utf8proc_uint8_t;
}
unsafe extern "C" {
#[doc = " NFKC_Casefold normalization (@ref UTF8PROC_COMPOSE and @ref UTF8PROC_COMPAT\n and @ref UTF8PROC_CASEFOLD and @ref UTF8PROC_IGNORE)."]
pub fn utf8proc_NFKC_Casefold(str_: *const utf8proc_uint8_t) -> *mut utf8proc_uint8_t;
}