pub trait IntoCStrArray: Sealed {
type CStrArray: AsCStrArray;
// Required method
fn into_c_str_array(self) -> Self::CStrArray;
}Expand description
Types that can be converted into an AsCStrArray
This trait is the bound that is actually required for the Exec::execve
function. By using this trait instead of AsCStrArray directly, execve
can accept types that either implement AsCStrArray directly or can be
converted into one, such as Vec<CString>. This reduces the need for users
to manually convert their string collections into BorrowedCStrss or other
AsCStrArray implementors before passing them to execve.
Note that implementations of this trait may perform conversions that involve
heap allocations, so users should be aware of the potential performance
implications when using this trait with types that do not directly implement
AsCStrArray.
This trait is currently sealed to avoid breakage in a possible future extension. Please open an issue if you have a use case for implementing this trait for a type defined outside this crate and would like it to be unsealed.
Required Associated Types§
Sourcetype CStrArray: AsCStrArray
type CStrArray: AsCStrArray
The type that self can be converted into, which must implement AsCStrArray.
Required Methods§
Sourcefn into_c_str_array(self) -> Self::CStrArray
fn into_c_str_array(self) -> Self::CStrArray
Converts self into a type that implements AsCStrArray.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a, T> IntoCStrArray for &'a [T]
Converts a slice of &CStrs into a BorrowedCStrs. (See
BorrowedCStrs::from_iter.)
impl<'a, T> IntoCStrArray for &'a [T]
Converts a slice of &CStrs into a BorrowedCStrs. (See
BorrowedCStrs::from_iter.)
type CStrArray = BorrowedCStrs<'a>
fn into_c_str_array(self) -> BorrowedCStrs<'a>
Source§impl<T> IntoCStrArray for Vec<T>
Converts a Vec<T> into an OwnedCStrs. (See OwnedCStrs::from_iter.)
impl<T> IntoCStrArray for Vec<T>
Converts a Vec<T> into an OwnedCStrs. (See OwnedCStrs::from_iter.)
type CStrArray = OwnedCStrs
fn into_c_str_array(self) -> OwnedCStrs
Implementors§
Source§impl<T: AsCStrArray> IntoCStrArray for T
Any type that implements AsCStrArray can be converted into a
AsCStrArray by identity conversion.
impl<T: AsCStrArray> IntoCStrArray for T
Any type that implements AsCStrArray can be converted into a
AsCStrArray by identity conversion.