From: Matt Corallo Date: Sat, 18 Dec 2021 03:38:15 +0000 (+0000) Subject: Add a constructor to MultiThreadedLockableScore X-Git-Tag: v0.0.105~47^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=ae4f6198db4bf1dd5ab708c625276143d53239ba;p=rust-lightning Add a constructor to MultiThreadedLockableScore ...as otherwise the struct is rather useless. --- diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 2b2839d69..20a8afcab 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -168,6 +168,14 @@ impl<'a, T: Score + 'a> LockableScore<'a> for MultiThreadedLockableScore { } } +#[cfg(c_bindings)] +impl MultiThreadedLockableScore { + /// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + pub fn new(score: T) -> Self { + MultiThreadedLockableScore { score: Mutex::new(score) } + } +} + #[cfg(c_bindings)] /// (C-not exported) impl<'a, T: Writeable> Writeable for RefMut<'a, T> {