Safe Rust bindings for Apple's Metal framework — devices, resources, command encoding, advanced GPU objects, and IOSurface interop on macOS, backed by a Swift bridge
usestd::ffi::{CStr, CString};/// Calls the `Metal` framework counterpart for `c_string`.
pubfnc_string(value:&str)->Result<CString, String>{CString::new(value).map_err(|error|error.to_string())}/// Calls the `Metal` framework counterpart for `take_optional_string`.
pubunsafefntake_optional_string(ptr:*mutcore::ffi::c_char)->Option<String>{if ptr.is_null(){returnNone;}let value =CStr::from_ptr(ptr).to_string_lossy().into_owned();libc::free(ptr.cast());Some(value)}/// Calls the `Metal` framework counterpart for `take_string`.
pubunsafefntake_string(ptr:*mutcore::ffi::c_char)-> String{take_optional_string(ptr).unwrap_or_default()}