Skip to content

Commit ba728f9

Browse files
committed
Add ruby-rbs-sys Rust crate with FFI bindings for RBS parser
This establishes the foundation for using RBS functionality from Rust. - Generated FFI bindings via bindgen from RBS C headers - Set up build configuration to link with the RBS library - Added initial tests for basic functionality (constant pool, parser) - Configured workspace structure in rust/Cargo.toml The -sys crate follows Rust conventions for FFI bindings, keeping raw unsafe bindings separate from future safe API wrappers. Future commits will add a separate safe wrapper crate on top of these bindings.
1 parent 96225dc commit ba728f9

8 files changed

Lines changed: 644 additions & 0 deletions

File tree

.github/workflows/rust.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- ".github/workflows/rust.yml"
9+
- "rust/**"
10+
- "include/**"
11+
- "src/**"
12+
pull_request:
13+
paths:
14+
- ".github/workflows/rust.yml"
15+
- "rust/**"
16+
- "include/**"
17+
- "src/**"
18+
19+
env:
20+
RUSTFLAGS: "-D warnings"
21+
22+
jobs:
23+
test:
24+
name: cargo:test
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: [ubuntu-latest, macos-latest, windows-latest]
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Install Rust tools
33+
run: |
34+
rustup update --no-self-update stable
35+
rustup default stable
36+
- uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/.cargo/registry
40+
~/.cargo/git
41+
rust/target
42+
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-cargo-
45+
- name: Run tests
46+
run: |
47+
cd rust
48+
cargo test --verbose
49+
50+
lint:
51+
name: cargo:lint
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Install Rust tools
56+
run: |
57+
rustup update --no-self-update stable
58+
rustup default stable
59+
rustup component add --toolchain stable clippy rustfmt
60+
- uses: actions/cache@v4
61+
with:
62+
path: |
63+
~/.cargo/registry
64+
~/.cargo/git
65+
rust/target
66+
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
67+
restore-keys: |
68+
${{ runner.os }}-cargo-
69+
- name: Check formatting
70+
run: |
71+
cd rust
72+
cargo fmt --check
73+
- name: Run clippy
74+
run: |
75+
cd rust
76+
cargo clippy

rust/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/

rust/Cargo.lock

Lines changed: 296 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
members = [
3+
"ruby-rbs-sys",
4+
]
5+
6+
resolver = "3"

rust/ruby-rbs-sys/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "ruby-rbs-sys"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[lib]
7+
doctest = false
8+
9+
[build-dependencies]
10+
bindgen = "0.72.0"
11+
cc = "1.2.29"

0 commit comments

Comments
 (0)