Skip to content

Commit 744ed6b

Browse files
committed
Print non-cloneable ownership pass arguments everywhere and deprecate associated calls (most places).
1 parent a80dcf5 commit 744ed6b

22 files changed

+106
-36
lines changed

bindings/LDK/Bindings.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,12 +3938,11 @@ public class Bindings {
39383938
}
39393939

39403940
}
3941-
3942-
/// Non-cloneable types passed by ownership. Here be dragons!
3941+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
3942+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
39433943
public class func swift_C2Tuple_BlockHashChannelManagerZ_read(ser: [UInt8], arg: ChannelManagerReadArgs) -> Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
39443944

3945-
print("DANGER! Non-cloneable types passed by ownership. Affected arguments: [arg: ChannelManagerReadArgs (1)]")
3946-
3945+
39473946
let serWrapper = Bindings.new_LDKu8sliceWrapper(array: ser)
39483947
defer {
39493948
serWrapper.noOpRetain()

bindings/LDK/results/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ: NativeTypeWrap
5252
return nil
5353
}
5454

55-
public class func ok(o: C2Tuple_BlockHashChannelManagerZ) -> Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
55+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
56+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
57+
public class func ok(o: C2Tuple_BlockHashChannelManagerZ) -> Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5658

5759
return Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(pointer: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o.cOpaqueStruct!));
5860
}

bindings/LDK/results/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ: NativeTypeWrap
5252
return nil
5353
}
5454

55-
public class func ok(o: C2Tuple_BlockHashChannelMonitorZ) -> Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
55+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
56+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
57+
public class func ok(o: C2Tuple_BlockHashChannelMonitorZ) -> Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
5658

5759
return Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(pointer: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o.cOpaqueStruct!));
5860
}

bindings/LDK/results/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ: NativeTypeWrap
6262
return Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(pointer: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(oWrapper.dangle().cOpaqueStruct!));
6363
}
6464

65-
public class func err(e: LDKIOError) -> Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
65+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
66+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
67+
public class func err(e: LDKIOError) -> Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6668

6769
return Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(pointer: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e));
6870
}

bindings/LDK/results/Result_NoneErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public class Result_NoneErrorZ: NativeTypeWrapper {
5050
return Result_NoneErrorZ(pointer: CResult_NoneErrorZ_ok());
5151
}
5252

53-
public class func err(e: LDKIOError) -> Result_NoneErrorZ {
53+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
54+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
55+
public class func err(e: LDKIOError) -> Result_NoneErrorZ {
5456

5557
return Result_NoneErrorZ(pointer: CResult_NoneErrorZ_err(e));
5658
}

bindings/LDK/results/Result_PayeePubKeyErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class Result_PayeePubKeyErrorZ: NativeTypeWrapper {
5757
return Result_PayeePubKeyErrorZ(pointer: CResult_PayeePubKeyErrorZ_ok(o.danglingClone().cOpaqueStruct!));
5858
}
5959

60-
public class func err(e: LDKSecp256k1Error) -> Result_PayeePubKeyErrorZ {
60+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
61+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
62+
public class func err(e: LDKSecp256k1Error) -> Result_PayeePubKeyErrorZ {
6163

6264
return Result_PayeePubKeyErrorZ(pointer: CResult_PayeePubKeyErrorZ_err(e));
6365
}

bindings/LDK/results/Result_PublicKeyErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class Result_PublicKeyErrorZ: NativeTypeWrapper {
5757
return Result_PublicKeyErrorZ(pointer: CResult_PublicKeyErrorZ_ok(Bindings.new_LDKPublicKey(array: o)));
5858
}
5959

60-
public class func err(e: LDKSecp256k1Error) -> Result_PublicKeyErrorZ {
60+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
61+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
62+
public class func err(e: LDKSecp256k1Error) -> Result_PublicKeyErrorZ {
6163

6264
return Result_PublicKeyErrorZ(pointer: CResult_PublicKeyErrorZ_err(e));
6365
}

bindings/LDK/results/Result_SecretKeyErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class Result_SecretKeyErrorZ: NativeTypeWrapper {
5757
return Result_SecretKeyErrorZ(pointer: CResult_SecretKeyErrorZ_ok(Bindings.new_LDKSecretKey(array: o)));
5858
}
5959

60-
public class func err(e: LDKSecp256k1Error) -> Result_SecretKeyErrorZ {
60+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
61+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
62+
public class func err(e: LDKSecp256k1Error) -> Result_SecretKeyErrorZ {
6163

6264
return Result_SecretKeyErrorZ(pointer: CResult_SecretKeyErrorZ_err(e));
6365
}

bindings/LDK/results/Result_ShutdownScriptInvalidShutdownScriptZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class Result_ShutdownScriptInvalidShutdownScriptZ: NativeTypeWrapper {
5757
return Result_ShutdownScriptInvalidShutdownScriptZ(pointer: CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o.danglingClone().cOpaqueStruct!));
5858
}
5959

60-
public class func err(e: InvalidShutdownScript) -> Result_ShutdownScriptInvalidShutdownScriptZ {
60+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
61+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
62+
public class func err(e: InvalidShutdownScript) -> Result_ShutdownScriptInvalidShutdownScriptZ {
6163

6264
return Result_ShutdownScriptInvalidShutdownScriptZ(pointer: CResult_ShutdownScriptInvalidShutdownScriptZ_err(e.cOpaqueStruct!));
6365
}

bindings/LDK/results/Result_StringErrorZ.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class Result_StringErrorZ: NativeTypeWrapper {
5757
return Result_StringErrorZ(pointer: CResult_StringErrorZ_ok(Bindings.new_LDKStr(string: o)));
5858
}
5959

60-
public class func err(e: LDKSecp256k1Error) -> Result_StringErrorZ {
60+
#warning("This method passes non-cloneable objects by owned value. Here be dragons.")
61+
@available(*, deprecated, message: "This method passes non-cloneable objects by owned value. Here be dragons.")
62+
public class func err(e: LDKSecp256k1Error) -> Result_StringErrorZ {
6163

6264
return Result_StringErrorZ(pointer: CResult_StringErrorZ_err(e));
6365
}

0 commit comments

Comments
 (0)