Skip to content

Instantly share code, notes, and snippets.

Last active Jan 17, 2021
What would you like to do?
A PrefixInclusiveEvent helper type.
private enum PrefixInclusiveEvent<Output> {
/// A signal that upstream should complete successfully after a predicate-failing value.
case end
/// A signal that the inner associated value either passed the predicate or is the first not to.
case predicatePassingValueOrIncluded(Output)
/// An [enumeration property](
/// to check if `self` is a `predicatePassingValueOrIncluded` event.
var isPredicatePassingValueOrIncluded: Bool {
guard case .predicatePassingValueOrIncluded = self else { return false }
return true
/// An enumeration property for quick access to the output value, if present.
var output: Output? {
guard case let .predicatePassingValueOrIncluded(inner) = self else { return nil }
return inner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment