summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-03-23 02:31:29 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-03-23 02:32:21 +0100
commit7f147fe6f145061c4e7b6fa943a64c418369f88b (patch)
treea5726bcde49005aadcac9bf8f4cf9300b75b5c68
parent08b0b5e67a0976368395515e8a9f700e67758a43 (diff)
gen: Generate rust types for stdint types
-rw-r--r--src/gen.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gen.rs b/src/gen.rs
index 343bc8f5..a6ab7118 100644
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -90,10 +90,20 @@ fn rust_type_id(ctx: &mut GenCtx, name: &str) -> String {
"u32" | "f32" | "f64" | "i8" |
"i16" | "i32" | "i64" | "Self" |
"str" => {
- let mut s = "_".to_string();
+ let mut s = "_".to_owned();
s.push_str(name);
s
}
+ "int8_t" => "i8".to_owned(),
+ "uint8_t" => "u8".to_owned(),
+ "int16_t" => "i16".to_owned(),
+ "uint16_t" => "u16".to_owned(),
+ "int32_t" => "i32".to_owned(),
+ "uint32_t" => "u32".to_owned(),
+ "int64_t" => "i64".to_owned(),
+ "uint64_t" => "u64".to_owned(),
+ "size_t" => "usize".to_owned(),
+ "ssize_t" => "isize".to_owned(),
_ => first(rust_id(ctx, name))
}
}