Function
print_handle
(ret: &mut String, name: &Id, h: &HandleDatatype)
Source from the content-addressed store, hash-verified
| 307 | } |
| 308 | |
| 309 | fn print_handle(ret: &mut String, name: &Id, h: &HandleDatatype) { |
| 310 | ret.push_str(&format!( |
| 311 | "using __wasi_{}_t = int32_t;\n\n", |
| 312 | ident_name(name) |
| 313 | )); |
| 314 | |
| 315 | ret.push_str(&format!( |
| 316 | "static_assert(sizeof(__wasi_{}_t) == {}, \"witx calculated size\");\n", |
| 317 | ident_name(name), |
| 318 | h.mem_size() |
| 319 | )); |
| 320 | ret.push_str(&format!( |
| 321 | "static_assert(alignof(__wasi_{}_t) == {}, \"witx calculated align\");\n", |
| 322 | ident_name(name), |
| 323 | h.mem_align() |
| 324 | )); |
| 325 | |
| 326 | ret.push_str("\n"); |
| 327 | } |
| 328 | |
| 329 | fn ident_name(i: &Id) -> String { |
| 330 | i.as_str().to_string() |
Tested by
no test coverage detected