MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / copy_ffi_bytes

Function copy_ffi_bytes

packages/server/src/simulators/session.rs:527–543  ·  view source on GitHub ↗
(bytes: ffi::xcw_native_shared_bytes)

Source from the content-addressed store, hash-verified

525}
526
527unsafe fn copy_ffi_bytes(bytes: ffi::xcw_native_shared_bytes) -> Option<Bytes> {
528 if bytes.data.is_null() || bytes.length == 0 {
529 if !bytes.owner.is_null() {
530 unsafe {
531 ffi::xcw_native_release_shared_bytes(bytes);
532 }
533 }
534 return None;
535 }
536
537 let copied =
538 unsafe { Bytes::copy_from_slice(std::slice::from_raw_parts(bytes.data, bytes.length)) };
539 unsafe {
540 ffi::xcw_native_release_shared_bytes(bytes);
541 }
542 Some(copied)
543}
544
545fn c_string(ptr: *const i8) -> Option<String> {
546 if ptr.is_null() {

Callers 1

handle_frameMethod · 0.85

Calls 1

Tested by

no test coverage detected