mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 22:25:40 +00:00
Merge #589
589: wasmer-c-api-changes: making `wasmer_byte_array` fields `public` r=bjfish a=YaronWittenstein
I've added this PR since I've tests that need access to `wasmer_byte_array` field.
Here is an example:
52f04b52cc/crates/svm-wasmer-c-api/tests/c_api.rs (L96)
```rust
unsafe fn cast_wasmer_byte_array_to_string(wasmer_bytes: &wasmer_byte_array) -> String {
let slice: &[u8] =
std::slice::from_raw_parts(wasmer_bytes.bytes, wasmer_bytes.bytes_len as usize);
if let Ok(s) = std::str::from_utf8(slice) {
s.to_string()
} else {
panic!("error converting `wasmer_byte_array` to string")
}
}
```
@syrusakbary @bjfish @Hywan
Co-authored-by: Yaron Wittenstein <yaron.wittenstein@gmail.com>
Co-authored-by: Brandon Fish <bjfish@users.noreply.github.com>
This commit is contained in:
commit
f8fa06e5ed
@ -118,6 +118,6 @@ pub struct wasmer_limit_option_t {
|
|||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct wasmer_byte_array {
|
pub struct wasmer_byte_array {
|
||||||
bytes: *const u8,
|
pub bytes: *const u8,
|
||||||
bytes_len: u32,
|
pub bytes_len: u32,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user