Struct CStringArray

pub struct CStringArray { pub(in ::sys::process::unix::common::cstring_array) ptrs: Vec<*const c_char> }

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

impl CStringArray

fn with_capacity(capacity: usize) -> Self

Creates a new CStringArray with enough capacity to hold capacity strings.

fn write(&mut self, index: usize, item: CString)

Replace the string at position index.

fn push(&mut self, item: CString)

Push an additional string to the array.

fn as_ptr(&self) -> *const *const c_char

Returns a pointer to the C-string array managed by this type.

fn iter(&self) -> CStringIter<'_>

Returns an iterator over all CStrs contained in this array.

Trait Implementations

impl Debug for CStringArray

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Drop for CStringArray

fn drop(&mut self)

impl Index<usize> for CStringArray

type Output = CStr;
fn index(&self, index: usize) -> &CStr

impl Send for CStringArray

impl Sync for CStringArray

Auto Trait Implementations

impl Freeze for CStringArray

impl RefUnwindSafe for CStringArray

impl Unpin for CStringArray

impl UnsafeUnpin for CStringArray

impl UnwindSafe for CStringArray

Blanket Implementations

impl<T> Any for CStringArray where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for CStringArray where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for CStringArray where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for CStringArray

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for CStringArray where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for CStringArray

impl<T, U> Into<U> for CStringArray where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for CStringArray where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for CStringArray where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>