Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / NodeFeatures.swift
1 import LDKCHeaders
2
3 public class NodeFeatures {
4
5     public internal(set) var cOpaqueStruct: LDKNodeFeatures?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init() {
9         
10         self.cOpaqueStruct = NodeFeatures_known()
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKNodeFeatures){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func eq(a: NodeFeatures, b: NodeFeatures) -> Bool {
21         
22         return withUnsafePointer(to: a.cOpaqueStruct!) { (aPointer: UnsafePointer<LDKNodeFeatures>) in
23 withUnsafePointer(to: b.cOpaqueStruct!) { (bPointer: UnsafePointer<LDKNodeFeatures>) in
24 NodeFeatures_eq(aPointer, bPointer)
25 }
26 };
27     }
28
29     public func clone(orig: NodeFeatures) -> NodeFeatures {
30         
31         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKNodeFeatures>) in
32 NodeFeatures(pointer: NodeFeatures_clone(origPointer))
33 };
34     }
35
36     public func supports_payment_secret() -> Bool {
37         
38         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKNodeFeatures>) in
39 NodeFeatures_supports_payment_secret(this_argPointer)
40 };
41     }
42
43     public func write(obj: NodeFeatures) -> [UInt8] {
44         
45         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKNodeFeatures>) in
46 NodeFeatures_write(objPointer)
47 });
48     }
49
50     public func read(ser: [UInt8]) -> Result_NodeFeaturesDecodeErrorZ {
51         
52         return Result_NodeFeaturesDecodeErrorZ(pointer: NodeFeatures_read(Bindings.new_LDKu8slice(array: ser)));
53     }
54
55                                 
56         deinit {
57                                         if self.cOpaqueStruct?.is_owned == false {
58
59                                         
60                                         
61                 NodeFeatures_free(self.cOpaqueStruct!)
62                                         
63 }
64                                 
65         }
66                         
67     /* STRUCT_METHODS_END */
68
69 }