pyo3_ffi/
codecs.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use crate::object::PyObject;
use std::os::raw::{c_char, c_int};

extern "C" {
    pub fn PyCodec_Register(search_function: *mut PyObject) -> c_int;
    #[cfg(Py_3_10)]
    #[cfg(not(PyPy))]
    pub fn PyCodec_Unregister(search_function: *mut PyObject) -> c_int;
    // skipped non-limited _PyCodec_Lookup from Include/codecs.h
    // skipped non-limited _PyCodec_Forget from Include/codecs.h
    pub fn PyCodec_KnownEncoding(encoding: *const c_char) -> c_int;
    pub fn PyCodec_Encode(
        object: *mut PyObject,
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_Decode(
        object: *mut PyObject,
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    // skipped non-limited _PyCodec_LookupTextEncoding from Include/codecs.h
    // skipped non-limited _PyCodec_EncodeText from Include/codecs.h
    // skipped non-limited _PyCodec_DecodeText from Include/codecs.h
    // skipped non-limited _PyCodecInfo_GetIncrementalDecoder from Include/codecs.h
    // skipped non-limited _PyCodecInfo_GetIncrementalEncoder from Include/codecs.h
    pub fn PyCodec_Encoder(encoding: *const c_char) -> *mut PyObject;
    pub fn PyCodec_Decoder(encoding: *const c_char) -> *mut PyObject;
    #[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalEncoder")]
    pub fn PyCodec_IncrementalEncoder(
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    #[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalDecoder")]
    pub fn PyCodec_IncrementalDecoder(
        encoding: *const c_char,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_StreamReader(
        encoding: *const c_char,
        stream: *mut PyObject,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_StreamWriter(
        encoding: *const c_char,
        stream: *mut PyObject,
        errors: *const c_char,
    ) -> *mut PyObject;
    pub fn PyCodec_RegisterError(name: *const c_char, error: *mut PyObject) -> c_int;
    pub fn PyCodec_LookupError(name: *const c_char) -> *mut PyObject;
    pub fn PyCodec_StrictErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_IgnoreErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_ReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_XMLCharRefReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    pub fn PyCodec_BackslashReplaceErrors(exc: *mut PyObject) -> *mut PyObject;
    // skipped non-limited PyCodec_NameReplaceErrors from Include/codecs.h
    // skipped non-limited Py_hexdigits from Include/codecs.h
}