├── .gitignore ├── Makefile ├── README.md ├── hello.cpp └── rust.h /.gitignore: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CXX ?= clang 2 | 3 | .PHONY: test clean 4 | 5 | hello: hello.cpp rust.h 6 | $(CXX) hello.cpp -o hello -I. -std=c++17 -Wall -Wextra 7 | 8 | test: hello 9 | ./hello 10 | 11 | clean: 12 | rm -f hello 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rs-cpp 2 | 3 | **rs-cpp** is a C++ header that attempts to bring Rust-like semantics to C++. 4 | 5 | ### How do I use it? 6 | 7 | ```cpp 8 | #include 9 | #include 10 | 11 | fn main() -> i32 { 12 | let message = "Hello, World!"; 13 | puts(message); 14 | return 0; 15 | } 16 | ``` 17 | 18 | ### Luna, please, at this rate you'll have more joke projects on GitHub than serious ones... 19 | 20 | ...so what? 21 | 22 | -------------------------------------------------------------------------------- /hello.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | fn main() -> i32 { 5 | let message = "Hello, World!"; 6 | puts(message); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /rust.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // numeric types 4 | #include 5 | using i8 = int8_t; 6 | using i16 = int16_t; 7 | using i32 = int32_t; 8 | using i64 = int64_t; 9 | using u8 = uint8_t; 10 | using u16 = uint16_t; 11 | using u32 = uint32_t; 12 | using u64 = uint64_t; 13 | using f32 = float; 14 | using f64 = double; 15 | 16 | // keywords 17 | #define let auto const 18 | #define self (*this) 19 | #define fn auto 20 | --------------------------------------------------------------------------------