pub struct C3String { /* private fields */ }Expand description
A standard C3 String. It holds a constant pointer to a c_void and an usize holding the length of the string.
Implementations§
Source§impl C3String
impl C3String
pub fn ptr(&self) -> *const c_void
pub fn len(&self) -> usize
Sourcepub fn into_c3_string<P>(value: P) -> Self
pub fn into_c3_string<P>(value: P) -> Self
Converts a given String or slice into a C3String.
Example:
c3ne_types::C3String::into_c3_string("Hello, World!");Sourcepub fn str_from_c3_string(&self) -> Result<&'static str, Box<dyn Error>>
pub fn str_from_c3_string(&self) -> Result<&'static str, Box<dyn Error>>
Converts a given C3String into a string slice.
Example:
let c3_string = c3ne_types::C3String::into_c3_string("Hello, World!");
assert!("Hello, World!", c3_string.str_from_c3_string().unwrap());Sourcepub fn into_c3_zstring<P>(value: P) -> C3ZString
pub fn into_c3_zstring<P>(value: P) -> C3ZString
Converts a given String or slice into a C3ZString.
Example:
c3ne_types::C3String::into_c3_zstring("Hello, World!");Sourcepub fn str_from_c3_zstring(
ptr: C3ZString,
) -> Result<&'static str, Box<dyn Error>>
pub fn str_from_c3_zstring( ptr: C3ZString, ) -> Result<&'static str, Box<dyn Error>>
Converts a given C3ZString into a string slice.
Example:
let c3_zstring = c3ne_types::C3String::into_c3_zstring("Hello, World!");
assert!("Hello, World!", c3ne_types::CString::str_from_c3_zstring(c3_zstring));Sourcepub fn into_c3_wstring<P>(value: P) -> C3WString
pub fn into_c3_wstring<P>(value: P) -> C3WString
Converts a given String or slice into a C3WString.
Example:
c3ne_types::C3String::into_c3_wstring("Hello, World!");Sourcepub fn str_from_c3_wstring(
ptr: C3WString,
) -> Result<&'static str, Box<dyn Error>>
pub fn str_from_c3_wstring( ptr: C3WString, ) -> Result<&'static str, Box<dyn Error>>
Converts a given C3WString into a string slice.
Example:
let c3_wstring = c3ne_types::C3String::into_c3_wstring("Hello, World!");
assert!("Hello, World!", c3ne_types::CString::str_from_c3_wstring(c3_wstring));Sourcepub fn into_c3_dstring<P>(value: P) -> C3DString
pub fn into_c3_dstring<P>(value: P) -> C3DString
Converts a given String or slice into a C3DString.
Example:
c3ne_types::C3String::into_c3_dstring("Hello, World!");Sourcepub fn str_from_c3_dstring(
ptr: C3DString,
) -> Result<&'static str, Box<dyn Error>>
pub fn str_from_c3_dstring( ptr: C3DString, ) -> Result<&'static str, Box<dyn Error>>
Converts a given C3DString into a string slice.
Example:
let c3_dstring = c3ne_types::C3String::into_c3_dstring("Hello, World!");
assert!("Hello, World!", c3ne_types::CString::str_from_c3_dstring(c3_dstring));Auto Trait Implementations§
impl !Send for C3String
impl !Sync for C3String
impl Freeze for C3String
impl RefUnwindSafe for C3String
impl Unpin for C3String
impl UnsafeUnpin for C3String
impl UnwindSafe for C3String
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