profile
viewpoint

issue commentrust-lang/rust

Tracking issue for `impl Trait` (RFC 1522, RFC 1951, RFC 2071)

@KrishnaSannasi Ah, interesting. Thanks!

aturon

comment created time in 2 months

issue commentrust-lang/rust

Tracking issue for `impl Trait` (RFC 1522, RFC 1951, RFC 2071)

Will something like the following be possible?

#![feature(existential_type)]

trait MyTrait {}

existential type Interface: MyTrait;

struct MyStruct {}
impl MyTrait for MyStruct {}

fn with<F, U>(cb: F) -> U
where
    F: FnOnce(&mut Interface) -> U
{
    let mut s = MyStruct {};
    cb(&mut s)
}
aturon

comment created time in 2 months

more