Skip to content

Commit c2c52a7

Browse files
committed
Handle bool primitive types (#54)
Since `bool` is a primitive type with direct FFI mapping between C and Rust, we don't need a wrapper struct like we do for complex types (`rbs_string_t`, etc.).
1 parent 296fb86 commit c2c52a7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

rust/ruby-rbs/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fn generate(config: &Config) -> Result<(), Box<dyn Error>> {
5252
for field in fields {
5353
match field.c_type.as_str() {
5454
"rbs_string" => writeln!(file, " {}: *const rbs_string_t,", field.name)?,
55+
"bool" => writeln!(file, " {}: bool,", field.name)?,
5556
_ => eprintln!("Unknown field type: {}", field.c_type),
5657
}
5758
}
@@ -67,6 +68,11 @@ fn generate(config: &Config) -> Result<(), Box<dyn Error>> {
6768
writeln!(file, " RBSString::new(self.{})", field.name)?;
6869
writeln!(file, " }}")?;
6970
}
71+
"bool" => {
72+
writeln!(file, " pub fn {}(&self) -> bool {{", field.name)?;
73+
writeln!(file, " self.{}", field.name)?;
74+
writeln!(file, " }}")?;
75+
}
7076
_ => eprintln!("Unknown field type: {}", field.c_type),
7177
}
7278
}

0 commit comments

Comments
 (0)