Sequence 1 | Sequence 2 | Result |
---|---|---|
1 | 1 | |
4 | 4 | |
2 | 2 | |
3 | 3 |
Last active
April 28, 2022 08:42
-
-
Save alexdremov/bb414a29e0f57f14059cb68eb352fabb to your computer and use it in GitHub Desktop.
Sequence 1 | Sequence 2 | Result |
---|---|---|
1 | awaits | |
2 | (1, 2) | |
3 | (1, 3) | |
4 | (4, 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AsyncSequence { | |
public func throttle<C: Clock, Reduced>( | |
for interval: C.Instant.Duration, | |
clock: C, | |
reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced | |
) -> AsyncThrottleSequence<Self, C, Reduced> | |
public func throttle<Reduced>( | |
for interval: Duration, | |
reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced | |
) -> AsyncThrottleSequence<Self, ContinuousClock, Reduced> | |
public func throttle<C: Clock>( | |
for interval: C.Instant.Duration, | |
clock: C, | |
latest: Bool = true | |
) -> AsyncThrottleSequence<Self, C, Element> | |
public func throttle( | |
for interval: Duration, | |
latest: Bool = true | |
) -> AsyncThrottleSequence<Self, ContinuousClock, Element> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment