use std::time::{Duration, SystemTime};
/// A utility for paying [`Invoice]`s.
-pub struct InvoicePayer<'a: 'b, 'b, P: Deref, R, S, L: Deref, E>
+pub struct InvoicePayer<P: Deref, R, S, L: Deref, E>
where
P::Target: Payer,
R: Router,
- S: routing::LockableScore<'a, 'b>,
+ S: for <'b> routing::LockableScore<'b>,
L::Target: Logger,
E: EventHandler,
{
event_handler: E,
payment_cache: Mutex<HashMap<PaymentHash, usize>>,
retry_attempts: RetryAttempts,
- phantom: std::marker::PhantomData<(&'a (), &'b ())>,
}
/// A trait defining behavior of an [`Invoice`] payer.
Sending(PaymentSendFailure),
}
-impl<'a: 'b, 'b, P: Deref, R, S, L: Deref, E> InvoicePayer<'a, 'b, P, R, S, L, E>
+impl<P: Deref, R, S, L: Deref, E> InvoicePayer<P, R, S, L, E>
where
P::Target: Payer,
R: Router,
- S: routing::LockableScore<'a, 'b>,
+ S: for <'b> routing::LockableScore<'b>,
L::Target: Logger,
E: EventHandler,
{
event_handler,
payment_cache: Mutex::new(HashMap::new()),
retry_attempts,
- phantom: std::marker::PhantomData,
}
}
Invoice::is_expired_from_epoch(&SystemTime::UNIX_EPOCH, expiry_time)
}
-impl<'a: 'b, 'b, P: Deref, R, S, L: Deref, E> EventHandler for InvoicePayer<'a, 'b, P, R, S, L, E>
+impl<P: Deref, R, S, L: Deref, E> EventHandler for InvoicePayer<P, R, S, L, E>
where
P::Target: Payer,
R: Router,
- S: routing::LockableScore<'a, 'b>,
+ S: for <'b> routing::LockableScore<'b>,
L::Target: Logger,
E: EventHandler,
{
fn payment_path_failed(&mut self, path: &Vec<RouteHop>, short_channel_id: u64);
}
-pub trait LockableScore<'a: 'b, 'b> {
- type Locked: Score;
-
- fn lock(&'a self) -> Self::Locked;
+///
+pub trait LockableScore<'b> {
+ ///
+ type Locked: Score + 'b;
+ ///
+ fn lock(&'b self) -> Self::Locked;
}
-impl<'a: 'b, 'b, S: 'b + Score, T: Deref<Target=Mutex<S>>> LockableScore<'a, 'b> for T {
+impl<'b, S: Score + 'b, T: Deref<Target=Mutex<S>>> LockableScore<'b> for T {
type Locked = MutexGuard<'b, S>;
-
- fn lock(&'a self) -> Self::Locked {
+ fn lock(&'b self) -> MutexGuard<'b, S> {
self.deref().lock().unwrap()
}
}