19 releases

Uses old Rust 2015

0.9.8 May 13, 2020
0.9.7 Oct 21, 2019
0.9.5 Sep 16, 2019
0.9.1 Nov 16, 2018
0.6.0 Feb 27, 2017

#1126 in Text processing

Download history 1912/week @ 2024-07-21 3206/week @ 2024-07-28 2862/week @ 2024-08-04 4563/week @ 2024-08-11 2673/week @ 2024-08-18 3817/week @ 2024-08-25 3245/week @ 2024-09-01 3922/week @ 2024-09-08 2374/week @ 2024-09-15 2637/week @ 2024-09-22 2641/week @ 2024-09-29 4370/week @ 2024-10-06 3038/week @ 2024-10-13 3767/week @ 2024-10-20 3368/week @ 2024-10-27 3265/week @ 2024-11-03

13,707 downloads per month

Apache-2.0 OR MIT

53KB
518 lines

encoding_c

docs.rs Apache 2 / MIT dual-licensed

encoding_c is an FFI wrapper for encoding_rs.

Bindings for encoding_rs::mem

See the encoding_c_mem crate for bindings for encoding_rs::mem.

Licensing

Please see the file named COPYRIGHT.

No Unwinding Support!

This crate is meant for use in binaries compiled with panic = 'abort', which is required for correctness! Unwinding across FFI is Undefined Behavior, and this crate does nothing to try to prevent unwinding across the FFI if compiled with unwinding enabled.

C/C++ Headers

include/encoding_rs.h and include/encoding_rs_statics.h are needed for C usage.

include/encoding_rs_cpp.h is a sample C++ API built on top of the C API using GSL and the C++ standard library. Since C++ project typically roll their own string classes, etc., it's probably necessary for C++ projects to manually adapt the header to their replacements of standard-library types.

There's a write-up about the C++ wrappers.

Release Notes

0.9.8

  • Remove year from copyright notices.

0.9.7

  • Specify a links value in the Cargo manifest.
  • Emit an include_dir variable from build script so that other build scripts depending on this crate can rely on it.

0.9.6

  • Fix a bug in the C++ header.

0.9.5

  • Adjust documentation for encoding_rs 0.8.20.

0.9.4

  • Fix bogus C header.

0.9.3

  • Fix bogus C++ header.

0.9.2

  • Wrap Decoder::latin1_byte_compatible_up_to.

0.9.1

  • Wrap Encoding::is_single_byte().
  • Pass through new feature flags introduced in encoding_rs 0.8.11.

0.9.0

  • Update to encoding_rs 0.8.0.

0.8.0

  • Update to encoding_rs 0.7.0.
  • Drop encoding_for_name().
  • Deal correctly with the data() method of gsl::span returning nullptr.

0.7.6

  • Rename ENCODING_RS_NON_NULL_CONST_ENCODING_PTR to ENCODING_RS_NOT_NULL_CONST_ENCODING_PTR. (Not a breaking change, because defining that macro broke the build previously, so the macro couldn't have been used.)
  • Use the macro only for statics and not for return values.

0.7.5

  • Annotate the encoding pointers that should be wrapped with a same-representation not-null type in C++ as ENCODING_RS_NON_NULL_CONST_ENCODING_PTR.

0.7.4

  • Wrap has_pending_state().

0.7.3

  • Use C preprocessor definitions for encoding constant declarations.

0.7.2

  • Parametrize the struct type names behind C preprocessor definitions.
  • Leave it to the user to provide char16_t. Avoid including a header for it.

0.7.1

  • Fix documentation for pointers that get used in std::slice::from_raw_parts().

0.7.0

  • Map None to SIZE_MAX in the max length calculation functions.

0.6.0

  • Check in the cheddar-generated header and comment out the cheddar-using build.rs.

0.5.0

  • Initial release of encoding_c. (I.e. first release with FFI in a distinct crate.)

Dependencies

~3.5MB
~119K SLoC