+ pub probe_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, duration_since_epoch: u64),
+ /// Scorers may wish to reduce their certainty of channel liquidity information over time.
+ /// Thus, this method is provided to allow scorers to observe the passage of time - the holder
+ /// of this object should call this method regularly (generally via the
+ /// `lightning-background-processor` crate).
+ pub time_passed: extern "C" fn (this_arg: *mut c_void, duration_since_epoch: u64),
+ /// Frees any resources associated with this object given its this_arg pointer.
+ /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+unsafe impl Send for ScoreUpdate {}
+unsafe impl Sync for ScoreUpdate {}
+#[allow(unused)]
+pub(crate) fn ScoreUpdate_clone_fields(orig: &ScoreUpdate) -> ScoreUpdate {
+ ScoreUpdate {
+ this_arg: orig.this_arg,
+ payment_path_failed: Clone::clone(&orig.payment_path_failed),
+ payment_path_successful: Clone::clone(&orig.payment_path_successful),
+ probe_failed: Clone::clone(&orig.probe_failed),
+ probe_successful: Clone::clone(&orig.probe_successful),
+ time_passed: Clone::clone(&orig.time_passed),
+ free: Clone::clone(&orig.free),
+ }
+}
+
+use lightning::routing::scoring::ScoreUpdate as rustScoreUpdate;
+impl rustScoreUpdate for ScoreUpdate {
+ fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+ (self.payment_path_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+ }
+ fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+ (self.payment_path_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+ }
+ fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+ (self.probe_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+ }
+ fn probe_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+ (self.probe_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+ }
+ fn time_passed(&mut self, mut duration_since_epoch: core::time::Duration) {
+ (self.time_passed)(self.this_arg, duration_since_epoch.as_secs())
+ }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl core::ops::Deref for ScoreUpdate {
+ type Target = Self;
+ fn deref(&self) -> &Self {
+ self
+ }
+}
+impl core::ops::DerefMut for ScoreUpdate {
+ fn deref_mut(&mut self) -> &mut Self {
+ self
+ }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn ScoreUpdate_free(this_ptr: ScoreUpdate) { }
+impl Drop for ScoreUpdate {
+ fn drop(&mut self) {
+ if let Some(f) = self.free {
+ f(self.this_arg);
+ }
+ }
+}
+/// A trait which can both lookup and update routing channel penalty scores.
+///
+/// This is used in places where both bounds are required and implemented for all types which
+/// implement [`ScoreLookUp`] and [`ScoreUpdate`].
+///
+/// Bindings users may need to manually implement this for their custom scoring implementations.
+#[repr(C)]
+pub struct Score {
+ /// An opaque pointer which is passed to your function implementations as an argument.
+ /// This has no meaning in the LDK, and can be NULL or any other value.
+ pub this_arg: *mut c_void,
+ /// Implementation of ScoreLookUp for this object.
+ pub ScoreLookUp: crate::lightning::routing::scoring::ScoreLookUp,
+ /// Implementation of ScoreUpdate for this object.
+ pub ScoreUpdate: crate::lightning::routing::scoring::ScoreUpdate,