pub trait LockableScore<'a> {
    type Score: 'a + Score;
    type Locked: DerefMut<Target = Self::Score>;

    // Required method
    fn lock(&'a self) -> Self::Locked;
}
Expand description

A scorer that is accessed under a lock.

Needed so that calls to Score::channel_penalty_msat in find_route can be made while having shared ownership of a scorer but without requiring internal locking in Score implementations. Internal locking would be detrimental to route finding performance and could result in Score::channel_penalty_msat returning a different value for the same channel.

Required Associated Types§

type Score: 'a + Score

The Score type.

type Locked: DerefMut<Target = Self::Score>

The locked Score type.

Required Methods§

fn lock(&'a self) -> Self::Locked

Returns the locked scorer.

Implementations on Foreign Types§

§

impl<'a, T> LockableScore<'a> for RefCell<T>
where T: 'a + Score,

§

type Score = T

§

type Locked = RefMut<'a, T>

§

fn lock(&'a self) -> <RefCell<T> as LockableScore<'a>>::Locked

§

impl<'a, T> LockableScore<'a> for Mutex<T>
where T: 'a + Score,

§

type Score = T

§

type Locked = MutexGuard<'a, T>

§

fn lock(&'a self) -> <Mutex<T> as LockableScore<'a>>::Locked

Implementors§