mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1495] [FEAT] Port all the common_* files, teletext and networking portions of libccx to rust
#2223
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1495
State: closed
Merged: No
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
This PR aims to port most of the functions in files
common_*,teletext.h,telxcc.c,networking.cand certain parts ofutility.c(such as logging) to rust. Certain parts of the codebase is left blank if they are dependant on some code which this PR has not aimed to convert. Such parts will have to be revisited once their dependencies are also converted to rust.I have placed the new rust code inside a new crate named as
lib_ccxr, which is a normal rust library crate. This was because a static library crate does not allow doctests. This would also help in seperating ffi code to idiomatic Rust code. Since the Rust approach and C approach to solve a problem are very different, there are 3 layers of indirection I have used for porting:1. The C-FFI layer
This layers will have function names same as defined in C but with the prefix of
ccxr_. These functions will handle the conversion between C-native types and Rust-native types and then pass it on to the C-like Rust layer. These are the functions defined in theccx_rustcrate underlibccxr_exportsmodule.2. The C-like Rust layer
This layer will have function names same as defined in C but work with Rust-native types. The code written using these functions would still be procedural but in Rust, hence the name C-like Rust. The entire task of these functions will be to translate the procedural code to idiomatic Rust code. These are the functions defined in the
c_functions.rsfile in appropriate modules inside thelib_ccxrcrate.3. The Idiomatic Rust layer
This layer will be the code written as one is supposed to write in idiomatic Rust. It will have complete documentation and tests. This code will will be situated in the
lib_ccxrcrate.