pub struct CStringArray {
ptrs: Vec<*const c_char>,
}
Expand description
Helper type to manage ownership of the strings within a C-style array.
This type manages an array of C-string pointers terminated by a null
pointer. The pointer to the array (as returned by as_ptr
) can be used as
a value of argv
or environ
.
Fields§
§ptrs: Vec<*const c_char>
Implementations§
Source§impl CStringArray
impl CStringArray
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new CStringArray
with enough capacity to hold capacity
strings.
Sourcepub fn as_ptr(&self) -> *const *const c_char
pub fn as_ptr(&self) -> *const *const c_char
Returns a pointer to the C-string array managed by this type.
Sourcepub fn iter(&self) -> CStringIter<'_> ⓘ
pub fn iter(&self) -> CStringIter<'_> ⓘ
Returns an iterator over all CStr
s contained in this array.
Trait Implementations§
Source§impl Debug for CStringArray
impl Debug for CStringArray
Source§impl Drop for CStringArray
impl Drop for CStringArray
Source§impl Index<usize> for CStringArray
impl Index<usize> for CStringArray
impl Send for CStringArray
impl Sync for CStringArray
Auto Trait Implementations§
impl Freeze for CStringArray
impl RefUnwindSafe for CStringArray
impl Unpin for CStringArray
impl UnwindSafe for CStringArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more