X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Ftypes.rs;h=d945431199eab2ba51a9fffac3498f0bd3d5582c;hp=395441b185f15476be764de81d7401b968795d85;hb=1926a7a71ae0f37ebd6562996769334e0af0cf1b;hpb=7ae0ad1e6274e614ec82fc84f317db09884b4beb diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 395441b..d945431 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -842,8 +842,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 3]" if !is_ref => Some("crate::c_types::ThreeBytes"), // Used for RGB values "str" if is_ref => Some("crate::c_types::Str"), - "String" if !is_ref => Some("crate::c_types::derived::CVec_u8Z"), - "String" if is_ref => Some("crate::c_types::Str"), + "String" => Some("crate::c_types::Str"), "std::time::Duration" => Some("u64"), "std::time::SystemTime" => Some("u64"), @@ -915,7 +914,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[usize]" if is_ref => Some(""), "str" if is_ref => Some(""), - "String" if !is_ref => Some("String::from_utf8("), + "String" => Some(""), // Note that we'll panic for String if is_ref, as we only have non-owned memory, we // cannot create a &String. @@ -980,8 +979,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8]" if is_ref => Some(".to_slice()"), "[usize]" if is_ref => Some(".to_slice()"), - "str" if is_ref => Some(".into()"), - "String" if !is_ref => Some(".into_rust()).unwrap()"), + "str" if is_ref => Some(".into_str()"), + "String" => Some(".into_string()"), "std::time::Duration" => Some(")"), "std::time::SystemTime" => Some("))"), @@ -1129,8 +1128,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[usize]" if is_ref => Some(""), "str" if is_ref => Some(".into()"), - "String" if !is_ref => Some(".into_bytes().into()"), "String" if is_ref => Some(".as_str().into()"), + "String" => Some(".into()"), "std::time::Duration" => Some(".as_secs()"), "std::time::SystemTime" => Some(".duration_since(::std::time::SystemTime::UNIX_EPOCH).expect(\"Times must be post-1970\").as_secs()"),