Skip to content

Conversation

@alexcrocha
Copy link

@alexcrocha alexcrocha commented Jul 24, 2025

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.

@alexcrocha
Copy link
Author

^ Looks like Rust CI is working as intended 👀

@alexcrocha alexcrocha force-pushed the ar-rust branch 3 times, most recently from 825c965 to 223d780 Compare July 25, 2025 21:56
@alexcrocha alexcrocha marked this pull request as ready for review July 25, 2025 22:01
fn source_files<P: AsRef<Path>>(root_dir: P) -> Vec<String> {
let mut files = Vec::new();

for entry in fs::read_dir(root_dir.as_ref()).unwrap() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for entry in fs::read_dir(root_dir.as_ref()).unwrap() {
for entry in fs::read_dir(root_dir.as_ref()).map_err(|e| format!("Failed to read source directory: {}", e))? {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, if you map the error into a string, what happens with the for loop?

let path = entry.path();

if path.is_file() {
let path = path.to_str().unwrap().to_string();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let path = path.to_str().unwrap().to_string();
let path = path.to_str()
.ok_or_else(|| format!("Invalid UTF-8 in filename: {:?}", path))?
.to_string();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this too would put a string in a place where we expect a file path.

@alexcrocha alexcrocha force-pushed the ar-rust branch 2 times, most recently from f7071bc to 4f43565 Compare August 15, 2025 20:58
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at this point. With the addition of the second crate, we may discover the need for a few adjustments, but it seems ready

Comment on lines +5 to +6
branches:
- master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the branches part necessary? We want this to run on any commit that matches the given paths, so maybe we can remove this?

@soutaro
Copy link

soutaro commented Jan 14, 2026

@alexcrocha This PR looks fine to me. I think rebasing on top of the latest trunk would fix the test failure.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants