Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftassociated typesSingle-choice MCQ

What does this generic code with a same-type `where` clause require of the caller?

protocol Producer { associatedtype Output func produce() -> Output } protocol Consumer { associatedtype Input func consume(_ x: Input) } func pipe<P: Producer, C: Consumer>(_ p: P, _ c: C) where P.Output == C.Input { c.consume(p.produce()) }