Login
You're viewing the functional.cafe public feed.
  • Nov 19, 2026, 1:10 AM

    Question for Rust programmers: Can the following Swift declarations be expressed in Rust?

    protocol N {
    associatedtype A: N
    }

    protocol O: N where A: O {}

    The obvious thing doesn't work, but I don't know Rust:

    trait N {
    type A: N;
    }

    trait O: N where Self::A: O {}

    This works, but are the two A's the same type?

    trait N {
    type A: N;
    }

    trait O: N {
    type A: O;
    }

    💬 4🔄 4⭐ 2

Replies