+impl Into<Str> for String {
+ fn into(self) -> Str {
+ let s = Box::leak(self.into_boxed_str());
+ Str { chars: s.as_ptr(), len: s.len(), chars_is_owned: true }
+ }
+}
+
+impl Drop for Str {
+ fn drop(&mut self) {
+ if self.chars_is_owned && self.len != 0 {
+ let _ = derived::CVec_u8Z { data: self.chars as *mut u8, datalen: self.len };
+ }
+ }
+}
+#[no_mangle]
+/// Frees the data buffer, if chars_is_owned is set and len > 0.
+pub extern "C" fn Str_free(_res: Str) { }