C2rust: Transpile C to Rust

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • c2rust

    Migrate C code to Rust

  • I converted https://github.com/FirefoxGraphics/qcms and then refactored it to mostly safe Rust. I ran into a number of issues https://github.com/immunant/c2rust/issues?q=is%3Aissue+autho... but it generally worked ok.

    I found refactoring the resulting Rust code somewhat error prone and didn't have great success with the automated tools. I'd recommend having a good test suite and suggest adjusting the C before the conversion to avoid using C features that don't translate well like the C preprocessor.

  • openjpeg

    Official repository of the OpenJPEG project (by Neopallium)

  • I just started using c2rust on openjpeg [0] (jpeg 2000 encoder/decoder) today and already have it working as a drop in replacement for the C libopenjp2.so on Linux. Still has a lot of unsafe code, but it does work. Which will be a big help with testing during refactoring to idiomatic safe Rust.

    c2rust also has a refactor command that helps with refactoring the generated Rust code.

    [0] https://github.com/Neopallium/openjpeg/tree/c2rust

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • corrode

    C to Rust translator

  • Back in the day there was also Corrode: https://github.com/jameysharp/corrode

  • qcms

    Rust color management

  • I converted https://github.com/FirefoxGraphics/qcms and then refactored it to mostly safe Rust. I ran into a number of issues https://github.com/immunant/c2rust/issues?q=is%3Aissue+autho... but it generally worked ok.

    I found refactoring the resulting Rust code somewhat error prone and didn't have great success with the automated tools. I'd recommend having a good test suite and suggest adjusting the C before the conversion to avoid using C features that don't translate well like the C preprocessor.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Best tools to convert code between languages?

    1 project | /r/learnprogramming | 11 Apr 2023
  • Translate C code to Rust working with libc

    1 project | /r/rust | 3 Apr 2023
  • Rewrite in Rust or Use Rust-bindings

    1 project | /r/rust | 21 Mar 2023
  • Red Black Tree in Rust

    4 projects | /r/rust | 4 Jan 2023
  • In Rust We Trust – A Transpiler from Unsafe C to Safer Rust

    1 project | /r/programmingcirclejerk | 5 Dec 2022