// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use std::ffi::{c_char, CStr}; /// # Safety /// /// The caller must ensure the char pointer must contain a valid /// UTF-8 string from a trusted source pub(crate) unsafe fn cstr_to_str(v: *const c_char) -> &'static str { let slice = CStr::from_ptr(v); let bytes = slice.to_bytes(); core::str::from_utf8_unchecked(bytes) }