projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2a8a396
)
Add a constructor to MultiThreadedLockableScore
author
Matt Corallo
<git@bluematt.me>
Sat, 18 Dec 2021 03:38:15 +0000
(
03:38
+0000)
committer
Matt Corallo
<git@bluematt.me>
Sat, 18 Dec 2021 20:20:23 +0000
(20:20 +0000)
...as otherwise the struct is rather useless.
lightning/src/routing/scoring.rs
patch
|
blob
|
history
diff --git
a/lightning/src/routing/scoring.rs
b/lightning/src/routing/scoring.rs
index 2b2839d69db82ec2640f7f24c02824b4d79b0b0b..20a8afcabcf827298229cb44ff9903cbc000c9f6 100644
(file)
--- 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<T> {
}
}
+#[cfg(c_bindings)]
+impl<T: Score> MultiThreadedLockableScore<T> {
+ /// 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> {