From: Matt Corallo Date: Thu, 29 Sep 2022 15:22:47 +0000 (+0000) Subject: Add `WriteableScore` bindings impl for `MultiThreadedLockableScore` X-Git-Tag: v0.0.112~5^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=refs%2Fheads%2F2022-10-mtlc-writer;p=rust-lightning Add `WriteableScore` bindings impl for `MultiThreadedLockableScore` In 56b07e52aabdaca521987e765f1fa864966a5d49 we made `MultiThreadedLockableScore` fully bindings-compatible. However, it did not add a `WriteableScore` implementation for it. This was an oversight as it is a `WriteableScore` in Rust and needs to be for use in other parts of the API. Here we add the required impl in a way that the bindings generator is able to handle it and add conversion utilities. --- diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index fefdebfcc..4052fac1b 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -225,6 +225,16 @@ impl<'a, T: Score + 'a> LockableScore<'a> for MultiThreadedLockableScore { } } +#[cfg(c_bindings)] +impl Writeable for MultiThreadedLockableScore { + fn write(&self, writer: &mut W) -> Result<(), io::Error> { + self.lock().write(writer) + } +} + +#[cfg(c_bindings)] +impl<'a, T: Score + 'a> WriteableScore<'a> for MultiThreadedLockableScore {} + #[cfg(c_bindings)] impl MultiThreadedLockableScore { /// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].