Struct paho_mqtt::string_collection::StringCollection
source · [−]pub struct StringCollection { /* private fields */ }
Expand description
A collection of C-compatible (NUL-terminated) strings that is useful
with C API’s that require an array of strings, normally specified as:
const char* arr[]
or const char** arr
Implementations
sourceimpl StringCollection
impl StringCollection
sourcepub fn new<T>(coll: &[T]) -> Self where
T: AsRef<str>,
pub fn new<T>(coll: &[T]) -> Self where
T: AsRef<str>,
Creates a StringCollection from a vector of string references.
Arguments
coll
A collection of string references.
sourcepub fn as_c_arr_ptr(&self) -> *const *const c_char
pub fn as_c_arr_ptr(&self) -> *const *const c_char
Gets the collection as a pointer to const C string pointers.
This returns a pointer that can be sent to a C API that takes a
pointer to an array of char pointers, like const char* arr[]
This function is inherently unsafe. The pointer it returns is only
valid while the collection remains unmodified. In general, it
should be requested when needed and not stored for future use.
sourcepub fn as_c_arr_mut_ptr(&self) -> *const *mut c_char
pub fn as_c_arr_mut_ptr(&self) -> *const *mut c_char
Gets the collection as a pointer to mutable C string pointers.
This returns a pointer that can be sent to a C API that takes a
pointer to an array of mutable char pointers, like char* arr[]
This function is inherently unsafe. The pointer it returns is only
valid while the collection remains unmodified. In general, it
should be requested when needed and not stored for future use.
This function is required due to the lax nature of the use of const strings in the C API. Hopefully the API will be fixed and this function can be removed
Trait Implementations
sourceimpl Clone for StringCollection
impl Clone for StringCollection
sourceimpl Debug for StringCollection
impl Debug for StringCollection
Auto Trait Implementations
impl RefUnwindSafe for StringCollection
impl !Send for StringCollection
impl !Sync for StringCollection
impl Unpin for StringCollection
impl UnwindSafe for StringCollection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more