Implement additional `Into<Str>` auto-conversion
authorMatt Corallo <git@bluematt.me>
Mon, 1 Nov 2021 18:35:43 +0000 (18:35 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 2 Nov 2021 16:54:45 +0000 (16:54 +0000)
lightning-c-bindings/src/c_types/mod.rs

index 69319563b72a8c2fd284fda2de9f7a9de460731f..c0c44bcf7470ae4b65924b2b552b012b2fb9f688 100644 (file)
@@ -450,6 +450,13 @@ impl Into<Str> for &'static str {
                Str { chars: self.as_ptr(), len: self.len(), chars_is_owned: false }
        }
 }
                Str { chars: self.as_ptr(), len: self.len(), chars_is_owned: false }
        }
 }
+impl Into<Str> for &mut &'static str {
+       fn into(self) -> Str {
+               let us: &'static str = *self;
+               us.into()
+       }
+}
+
 impl Str {
        pub(crate) fn into_str(&self) -> &'static str {
                if self.len == 0 { return ""; }
 impl Str {
        pub(crate) fn into_str(&self) -> &'static str {
                if self.len == 0 { return ""; }