(bytes: ffi::xcw_native_shared_bytes)
| 1588 | } |
| 1589 | |
| 1590 | unsafe fn copy_native_shared_bytes(bytes: ffi::xcw_native_shared_bytes) -> Option<Bytes> { |
| 1591 | let copied = if bytes.data.is_null() || bytes.length == 0 { |
| 1592 | None |
| 1593 | } else { |
| 1594 | Some(Bytes::copy_from_slice(slice::from_raw_parts( |
| 1595 | bytes.data, |
| 1596 | bytes.length, |
| 1597 | ))) |
| 1598 | }; |
| 1599 | ffi::xcw_native_release_shared_bytes(bytes); |
| 1600 | copied |
| 1601 | } |
| 1602 | |
| 1603 | unsafe fn native_c_string(value: *const i8) -> Option<String> { |
| 1604 | if value.is_null() { |
no test coverage detected