+// This file is Copyright its original authors, visible in version control
+// history and in the source files from which this was generated.
+//
+// This file is licensed under the license available in the LICENSE or LICENSE.md
+// file in the root of this repository or, if no such file exists, the same
+// license as that which applies to the original source files from which this
+// source was automatically generated.
+
//! The top-level network map tracking logic lives here.
use std::ffi::c_void;
#[must_use]
#[repr(C)]
pub struct NetworkGraph {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeNetworkGraph,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn NetworkGraph_free(this_ptr: NetworkGraph) { }
+pub extern "C" fn NetworkGraph_free(this_obj: NetworkGraph) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the NetworkGraph
pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
orig.clone()
}
#[must_use]
#[repr(C)]
pub struct LockedNetworkGraph {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeLockedNetworkGraph,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn LockedNetworkGraph_free(this_ptr: LockedNetworkGraph) { }
+pub extern "C" fn LockedNetworkGraph_free(this_obj: LockedNetworkGraph) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn LockedNetworkGraph_free_void(this_ptr: *mut c_void) {
#[must_use]
#[repr(C)]
pub struct NetGraphMsgHandler {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeNetGraphMsgHandler,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn NetGraphMsgHandler_free(this_ptr: NetGraphMsgHandler) { }
+pub extern "C" fn NetGraphMsgHandler_free(this_obj: NetGraphMsgHandler) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn NetGraphMsgHandler_free_void(this_ptr: *mut c_void) {
ret
}
}
+/// Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
#[no_mangle]
pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: &NetGraphMsgHandler) -> crate::ln::msgs::RoutingMessageHandler {
crate::ln::msgs::RoutingMessageHandler {
MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider {
this_arg: unsafe { (*this_arg).inner as *mut c_void },
free: None,
- get_and_clear_pending_msg_events: NetGraphMsgHandler_RoutingMessageHandler_get_and_clear_pending_msg_events,
+ get_and_clear_pending_msg_events: NetGraphMsgHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events,
},
}
}
local_ret
}
#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut _their_node_id: crate::c_types::PublicKey, mut _msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &_their_node_id.into_rust(), *unsafe { Box::from_raw(_msg.take_inner()) });
+extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ {
+ let mut ret = <nativeNetGraphMsgHandler as lightning::ln::msgs::RoutingMessageHandler<>>::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) });
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { 0u8 /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::LightningError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_ret
}
-#[must_use]
-extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ {
- let mut ret = <nativeNetGraphMsgHandler as lightning::util::events::MessageSendEventsProvider<>>::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeNetGraphMsgHandler) }, );
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::util::events::MessageSendEvent::native_into(item) }); };
- local_ret.into()
-}
impl From<nativeNetGraphMsgHandler> for crate::util::events::MessageSendEventsProvider {
fn from(obj: nativeNetGraphMsgHandler) -> Self {
ret
}
}
+/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
#[no_mangle]
pub extern "C" fn NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: &NetGraphMsgHandler) -> crate::util::events::MessageSendEventsProvider {
crate::util::events::MessageSendEventsProvider {
#[must_use]
#[repr(C)]
pub struct DirectionalChannelInfo {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeDirectionalChannelInfo,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn DirectionalChannelInfo_free(this_ptr: DirectionalChannelInfo) { }
+pub extern "C" fn DirectionalChannelInfo_free(this_obj: DirectionalChannelInfo) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn DirectionalChannelInfo_free_void(this_ptr: *mut c_void) {
pub extern "C" fn DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr: &mut DirectionalChannelInfo, mut val: u64) {
unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
}
+/// The maximum value which may be relayed to the next hop via the channel.
+#[no_mangle]
+pub extern "C" fn DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr: &DirectionalChannelInfo) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_maximum_msat;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { { crate::c_types::derived::COption_u64Z::Some(inner_val.unwrap()) } };
+ local_inner_val
+}
+/// The maximum value which may be relayed to the next hop via the channel.
+#[no_mangle]
+pub extern "C" fn DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr: &mut DirectionalChannelInfo, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *this_ptr.inner }.htlc_maximum_msat = local_val;
+}
/// Fees charged when the channel is used for routing
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_fees(this_ptr: &DirectionalChannelInfo) -> crate::routing::network_graph::RoutingFees {
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *this_ptr.inner }.last_update_message = local_val;
}
+/// Constructs a new DirectionalChannelInfo given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn DirectionalChannelInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut fees_arg: crate::routing::network_graph::RoutingFees, mut last_update_message_arg: crate::ln::msgs::ChannelUpdate) -> DirectionalChannelInfo {
+ let mut local_htlc_maximum_msat_arg = if htlc_maximum_msat_arg.is_some() { Some( { htlc_maximum_msat_arg.take() }) } else { None };
+ let mut local_last_update_message_arg = if last_update_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(last_update_message_arg.take_inner()) } }) };
+ DirectionalChannelInfo { inner: Box::into_raw(Box::new(nativeDirectionalChannelInfo {
+ last_update: last_update_arg,
+ enabled: enabled_arg,
+ cltv_expiry_delta: cltv_expiry_delta_arg,
+ htlc_minimum_msat: htlc_minimum_msat_arg,
+ htlc_maximum_msat: local_htlc_maximum_msat_arg,
+ fees: *unsafe { Box::from_raw(fees_arg.take_inner()) },
+ last_update_message: local_last_update_message_arg,
+ })), is_owned: true }
+}
impl Clone for DirectionalChannelInfo {
fn clone(&self) -> Self {
Self {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDirectionalChannelInfo)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the DirectionalChannelInfo
pub extern "C" fn DirectionalChannelInfo_clone(orig: &DirectionalChannelInfo) -> DirectionalChannelInfo {
orig.clone()
}
#[no_mangle]
+/// Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
pub extern "C" fn DirectionalChannelInfo_write(obj: &DirectionalChannelInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeDirectionalChannelInfo) })
}
#[no_mangle]
+/// Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
pub extern "C" fn DirectionalChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DirectionalChannelInfoDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::DirectionalChannelInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
#[must_use]
#[repr(C)]
pub struct ChannelInfo {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeChannelInfo,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn ChannelInfo_free(this_ptr: ChannelInfo) { }
+pub extern "C" fn ChannelInfo_free(this_obj: ChannelInfo) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn ChannelInfo_free_void(this_ptr: *mut c_void) {
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *this_ptr.inner }.two_to_one = local_val;
}
+/// The channel capacity as seen on-chain, if chain lookup is available.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_get_capacity_sats(this_ptr: &ChannelInfo) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.capacity_sats;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { { crate::c_types::derived::COption_u64Z::Some(inner_val.unwrap()) } };
+ local_inner_val
+}
+/// The channel capacity as seen on-chain, if chain lookup is available.
+#[no_mangle]
+pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *this_ptr.inner }.capacity_sats = local_val;
+}
/// An initial announcement of the channel
/// Mostly redundant with the data we store in fields explicitly.
/// Everything else is useful only for sending out for initial routing sync.
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *this_ptr.inner }.announcement_message = local_val;
}
+/// Constructs a new ChannelInfo given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelInfo_new(mut features_arg: crate::ln::features::ChannelFeatures, mut node_one_arg: crate::c_types::PublicKey, mut one_to_two_arg: crate::routing::network_graph::DirectionalChannelInfo, mut node_two_arg: crate::c_types::PublicKey, mut two_to_one_arg: crate::routing::network_graph::DirectionalChannelInfo, mut capacity_sats_arg: crate::c_types::derived::COption_u64Z, mut announcement_message_arg: crate::ln::msgs::ChannelAnnouncement) -> ChannelInfo {
+ let mut local_one_to_two_arg = if one_to_two_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(one_to_two_arg.take_inner()) } }) };
+ let mut local_two_to_one_arg = if two_to_one_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(two_to_one_arg.take_inner()) } }) };
+ let mut local_capacity_sats_arg = if capacity_sats_arg.is_some() { Some( { capacity_sats_arg.take() }) } else { None };
+ let mut local_announcement_message_arg = if announcement_message_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(announcement_message_arg.take_inner()) } }) };
+ ChannelInfo { inner: Box::into_raw(Box::new(nativeChannelInfo {
+ features: *unsafe { Box::from_raw(features_arg.take_inner()) },
+ node_one: node_one_arg.into_rust(),
+ one_to_two: local_one_to_two_arg,
+ node_two: node_two_arg.into_rust(),
+ two_to_one: local_two_to_one_arg,
+ capacity_sats: local_capacity_sats_arg,
+ announcement_message: local_announcement_message_arg,
+ })), is_owned: true }
+}
impl Clone for ChannelInfo {
fn clone(&self) -> Self {
Self {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelInfo)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the ChannelInfo
pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo {
orig.clone()
}
#[no_mangle]
+/// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelInfo) })
}
#[no_mangle]
+/// Read a ChannelInfo from a byte array, created by ChannelInfo_write
pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::ChannelInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
#[must_use]
#[repr(C)]
pub struct RoutingFees {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeRoutingFees,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn RoutingFees_free(this_ptr: RoutingFees) { }
+pub extern "C" fn RoutingFees_free(this_obj: RoutingFees) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn RoutingFees_free_void(this_ptr: *mut c_void) {
pub extern "C" fn RoutingFees_set_proportional_millionths(this_ptr: &mut RoutingFees, mut val: u32) {
unsafe { &mut *this_ptr.inner }.proportional_millionths = val;
}
+/// Constructs a new RoutingFees given each field
#[must_use]
#[no_mangle]
pub extern "C" fn RoutingFees_new(mut base_msat_arg: u32, mut proportional_millionths_arg: u32) -> RoutingFees {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRoutingFees)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the RoutingFees
pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees {
orig.clone()
}
#[no_mangle]
+/// Read a RoutingFees from a byte array, created by RoutingFees_write
pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::RoutingFees { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_res
}
#[no_mangle]
+/// Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
pub extern "C" fn RoutingFees_write(obj: &RoutingFees) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
#[must_use]
#[repr(C)]
pub struct NodeAnnouncementInfo {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeNodeAnnouncementInfo,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn NodeAnnouncementInfo_free(this_ptr: NodeAnnouncementInfo) { }
+pub extern "C" fn NodeAnnouncementInfo_free(this_obj: NodeAnnouncementInfo) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn NodeAnnouncementInfo_free_void(this_ptr: *mut c_void) {
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *this_ptr.inner }.announcement_message = local_val;
}
+/// Constructs a new NodeAnnouncementInfo given each field
#[must_use]
#[no_mangle]
pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::c_types::ThirtyTwoBytes, mut addresses_arg: crate::c_types::derived::CVec_NetAddressZ, mut announcement_message_arg: crate::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncementInfo)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the NodeAnnouncementInfo
pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> NodeAnnouncementInfo {
orig.clone()
}
#[no_mangle]
+/// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
pub extern "C" fn NodeAnnouncementInfo_write(obj: &NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncementInfo) })
}
#[no_mangle]
+/// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NodeAnnouncementInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
#[must_use]
#[repr(C)]
pub struct NodeInfo {
+ /// A pointer to the opaque Rust object.
+
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
pub inner: *mut nativeNodeInfo,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
pub is_owned: bool,
}
}
}
}
+/// Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn NodeInfo_free(this_ptr: NodeInfo) { }
+pub extern "C" fn NodeInfo_free(this_obj: NodeInfo) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
extern "C" fn NodeInfo_free_void(this_ptr: *mut c_void) {
let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
unsafe { &mut *this_ptr.inner }.announcement_info = local_val;
}
+/// Constructs a new NodeInfo given each field
#[must_use]
#[no_mangle]
pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u64Z, mut lowest_inbound_channel_fees_arg: crate::routing::network_graph::RoutingFees, mut announcement_info_arg: crate::routing::network_graph::NodeAnnouncementInfo) -> NodeInfo {
Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeInfo)).clone() })) as *mut c_void
}
#[no_mangle]
+/// Creates a copy of the NodeInfo
pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo {
orig.clone()
}
#[no_mangle]
+/// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
pub extern "C" fn NodeInfo_write(obj: &NodeInfo) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeInfo) })
}
#[no_mangle]
+/// Read a NodeInfo from a byte array, created by NodeInfo_write
pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NodeInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
local_res
}
#[no_mangle]
+/// Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
pub extern "C" fn NetworkGraph_write(obj: &NetworkGraph) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
}
crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNetworkGraph) })
}
#[no_mangle]
+/// Read a NetworkGraph from a byte array, created by NetworkGraph_write
pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ {
let res = crate::c_types::deserialize_obj(ser);
let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NetworkGraph { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };