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