]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Simplify type aliasing somewhat around times
authorMatt Corallo <git@bluematt.me>
Tue, 1 Mar 2022 03:47:28 +0000 (03:47 +0000)
committerJeffrey Czyz <jkczyz@gmail.com>
Sun, 3 Apr 2022 21:42:02 +0000 (16:42 -0500)
.. as the current C bindings generator isn't capable of handling
type aliases in generics in type alias definition currently.

lightning/src/routing/scoring.rs

index b7aa996ce2efae9622208e1293dcebf8b1b3d8b9..bf02271d27b4e4ea2815b676cfa8d9581c8316d6 100644 (file)
@@ -247,12 +247,10 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
        since = "0.0.105",
        note = "ProbabilisticScorer should be used instead of Scorer.",
 )]
-pub type Scorer = ScorerUsingTime::<ConfiguredTime>;
-
 #[cfg(not(feature = "no-std"))]
-type ConfiguredTime = std::time::Instant;
+pub type Scorer = ScorerUsingTime::<std::time::Instant>;
 #[cfg(feature = "no-std")]
-type ConfiguredTime = time::Eternity;
+pub type Scorer = ScorerUsingTime::<time::Eternity>;
 
 // Note that ideally we'd hide ScorerUsingTime from public view by sealing it as well, but rustdoc
 // doesn't handle this well - instead exposing a `Scorer` which has no trait implementation(s) or
@@ -503,7 +501,10 @@ impl<T: Time> Readable for ChannelFailure<T> {
 /// behavior.
 ///
 /// [1]: https://arxiv.org/abs/2107.05322
-pub type ProbabilisticScorer<G> = ProbabilisticScorerUsingTime::<G, ConfiguredTime>;
+#[cfg(not(feature = "no-std"))]
+pub type ProbabilisticScorer<G> = ProbabilisticScorerUsingTime::<G, std::time::Instant>;
+#[cfg(feature = "no-std")]
+pub type ProbabilisticScorer<G> = ProbabilisticScorerUsingTime::<G, time::Eternity>;
 
 /// Probabilistic [`Score`] implementation.
 ///