Struct ffi_pool::CStringPool
[−]
[src]
pub struct CStringPool { /* fields omitted */ }
A thread-safe pool of CString
s which can be readily reused with str
s for ease of FFI interactions.
Methods
impl CStringPool
[src]
fn new(default_string_capacity: usize) -> CStringPool
[src]
Create a new pool with a given default capacity for newly allocated CString
s.
fn with_capacity(
pool_capacity: usize,
default_string_capacity: usize
) -> CStringPool
[src]
pool_capacity: usize,
default_string_capacity: usize
) -> CStringPool
Create a new pool with an additional maximum capacity. Allocating new CString
s when the
pool is at capacity will block until a new CString
is available.
fn get_str<T: AsRef<str>>(&self, s: T) -> Result<Item<CString>, NulError>
[src]
Allocate a new CString
from the pool. This will check the supplied str
for interior nul
bytes.
fn get_c_str<T: AsRef<CStr>>(&self, s: T) -> Item<CString>
[src]
Allocate a new CString
from the pool, using a CStr
as a source.
Trait Implementations
impl Debug for CStringPool
[src]
impl Clone for CStringPool
[src]
fn clone(&self) -> CStringPool
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more