pub trait FfiSlice<T> {
// Required method
fn as_ffi_ptr(&self) -> *const T;
// Provided method
fn as_ffi_void_ptr(&self) -> *const c_void { ... }
}Expand description
FfiSlice exists to provide as_ffi_ptr on slices. Calling as_ptr on an
empty Rust slice may return the alignment of the type, rather than NULL, as
the pointer. When passing pointers into C/C++ code, that is not a valid
pointer. Thus this method should be used whenever passing a pointer to a
slice into BoringSSL code.
Required Methods§
Sourcefn as_ffi_ptr(&self) -> *const T
fn as_ffi_ptr(&self) -> *const T
Cast the slice into a valid raw pointer for FFI.
Provided Methods§
Sourcefn as_ffi_void_ptr(&self) -> *const c_void
fn as_ffi_void_ptr(&self) -> *const c_void
Cast the slice into a valid const void * pointer for FFI.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".