michwqy / Rust-demo

Rewrite a tiny c library using Rust as course project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Course Project about Refactoring C library with Rust

1 mycjson

Decription

Manually refactor Rust code translated from a C library, CJSON with an automated tool, c2rust.

How to use

cargo build --release
move the library in target/release
gcc test.c -o test librust_cjson.a -pthread -ldl
./test

2 buffer-rust

Decription

Rewrite a tiny C library, Buffer using Rust and compatible with Rust interface. The Rust code has the same semantics as the original C library, but it cannot be called in C code.

How to use

cargo build --release
cargo run

3 buffer

Decription

Rewrite a tiny C library, Buffer using Rust and compatible with C interface. The Rust code has the same semantics as the original C library, and it can be called in C code.

How to use

cargo build --release
move the library in target/release
gcc test.c -o test librust_buffer.a -pthread -ldl
./test

About

Rewrite a tiny c library using Rust as course project


Languages

Language:Rust 47.6%Language:C 39.1%Language:Makefile 13.3%