pub struct StrBuilder {
pub ptr: *const c_char,
pub len: usize,
}Expand description
A convenience structure for calling FFI interfaces to get strings
§Example
mod bindings {
pub enum Data {}
extern {
pub fn get_my_data_from_c(object: *const Data, start: *mut *const c_char, size: *mut usize);
}
}
use bindings::Data as Data;
impl Data {
pub fn my_data(&self) -> easy_ffi_wrapper::Str {
let mut value = easy_ffi_wrapper::StrBuilder::new();
unsafe {
bindings::get_my_data_from_c(self, &mut value.ptr, &mut value.len);
value.build()
}
}
}Fields§
§ptr: *const c_charPointer to the first character of the string to fill in, usually as an output parameter.
len: usizeLen of the string to fill in, usually as an output parameter.
Implementations§
Source§impl StrBuilder
impl StrBuilder
Trait Implementations§
Source§impl Debug for StrBuilder
impl Debug for StrBuilder
Auto Trait Implementations§
impl Freeze for StrBuilder
impl RefUnwindSafe for StrBuilder
impl !Send for StrBuilder
impl !Sync for StrBuilder
impl Unpin for StrBuilder
impl UnwindSafe for StrBuilder
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