1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class ChannelInfo extends CommonBase {
10 ChannelInfo(Object _dummy, long ptr) { super(ptr); }
11 @Override @SuppressWarnings("deprecation")
12 protected void finalize() throws Throwable {
14 if (ptr != 0) { bindings.ChannelInfo_free(ptr); }
17 public ChannelFeatures get_features() {
18 long ret = bindings.ChannelInfo_get_features(this.ptr);
19 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
20 ret_hu_conv.ptrs_to.add(this);
24 public void set_features(ChannelFeatures val) {
25 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
26 this.ptrs_to.add(val);
27 // Due to rust's strict-ownership memory model, in some cases we need to "move"
28 // an object to pass exclusive ownership to the function being called.
29 // In most cases, we avoid this being visible in GC'd languages by cloning the object
30 // at the FFI layer, creating a new object which Rust can claim ownership of
31 // However, in some cases (eg here), there is no way to clone an object, and thus
32 // we actually have to pass full ownership to Rust.
33 // Thus, after this call, val is reset to null and is now a dummy object.
37 public byte[] get_node_one() {
38 byte[] ret = bindings.ChannelInfo_get_node_one(this.ptr);
42 public void set_node_one(byte[] val) {
43 bindings.ChannelInfo_set_node_one(this.ptr, val);
46 public DirectionalChannelInfo get_one_to_two() {
47 long ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
48 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
49 ret_hu_conv.ptrs_to.add(this);
53 public void set_one_to_two(DirectionalChannelInfo val) {
54 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
55 this.ptrs_to.add(val);
58 public byte[] get_node_two() {
59 byte[] ret = bindings.ChannelInfo_get_node_two(this.ptr);
63 public void set_node_two(byte[] val) {
64 bindings.ChannelInfo_set_node_two(this.ptr, val);
67 public DirectionalChannelInfo get_two_to_one() {
68 long ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
69 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
70 ret_hu_conv.ptrs_to.add(this);
74 public void set_two_to_one(DirectionalChannelInfo val) {
75 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
76 this.ptrs_to.add(val);
79 public ChannelAnnouncement get_announcement_message() {
80 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
81 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
82 ret_hu_conv.ptrs_to.add(this);
86 public void set_announcement_message(ChannelAnnouncement val) {
87 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
88 this.ptrs_to.add(val);
91 public byte[] write() {
92 byte[] ret = bindings.ChannelInfo_write(this.ptr);
96 public static ChannelInfo constructor_read(byte[] ser) {
97 long ret = bindings.ChannelInfo_read(ser);
98 ChannelInfo ret_hu_conv = new ChannelInfo(null, ret);
99 ret_hu_conv.ptrs_to.add(ret_hu_conv);