#[repr(C)]
pub struct CStringArray { pub data: *const *const c_char, pub size: usize, }
Expand description

A utility type to represent arrays of string

Example

use ffi_convert::{CReprOf, CStringArray};
let pizza_names = vec!["Diavola".to_string(), "Margarita".to_string(), "Regina".to_string()];
let c_pizza_names = CStringArray::c_repr_of(pizza_names).expect("could not convert !");

Fields§

§data: *const *const c_char

Pointer to the first element of the array

§size: usize

Number of elements in the array

Trait Implementations§

source§

impl AsRust<Vec<String, Global>> for CStringArray

source§

impl CDrop for CStringArray

source§

fn do_drop(&mut self) -> Result<(), CDropError>

source§

impl CReprOf<Vec<String, Global>> for CStringArray

source§

impl Debug for CStringArray

source§

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

Formats the value using the given formatter. Read more
source§

impl Drop for CStringArray

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl RawPointerConverter<CStringArray> for CStringArray

source§

fn into_raw_pointer(self) -> *const CStringArray

Creates a raw pointer from the value and leaks it, you should use Self::from_raw_pointer or Self::drop_raw_pointer to free the value when you’re done with it.
source§

fn into_raw_pointer_mut(self) -> *mut CStringArray

Creates a mutable raw pointer from the value and leaks it, you should use Self::from_raw_pointer_mut or Self::drop_raw_pointer_mut to free the value when you’re done with it.
source§

unsafe fn from_raw_pointer_mut( input: *mut CStringArray ) -> Result<CStringArray, UnexpectedNullPointerError>

Takes back control of a raw pointer created by Self::into_raw_pointer_mut. Read more
source§

unsafe fn from_raw_pointer( input: *const CStringArray ) -> Result<CStringArray, UnexpectedNullPointerError>

Takes back control of a raw pointer created by Self::into_raw_pointer. Read more
source§

unsafe fn drop_raw_pointer( input: *const T ) -> Result<(), UnexpectedNullPointerError>

Takes back control of a raw pointer created by Self::into_raw_pointer and drop it. Read more
source§

unsafe fn drop_raw_pointer_mut( input: *mut T ) -> Result<(), UnexpectedNullPointerError>

Takes back control of a raw pointer created by Self::into_raw_pointer_mut and drops it. Read more
source§

impl Sync for CStringArray

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.