This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 3 files changed +66
-0
lines changed
3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ crate_type = "lib" ]
2
+
3
+ pub trait Backend {
4
+ type DescriptorSetLayout ;
5
+ }
6
+
7
+ pub struct Back ;
8
+
9
+ impl Backend for Back {
10
+ type DescriptorSetLayout = u32 ;
11
+ }
12
+
13
+ pub struct HalSetLayouts {
14
+ vertex_layout : <Back as Backend >:: DescriptorSetLayout ,
15
+ }
16
+
17
+ impl HalSetLayouts {
18
+ pub fn iter < DSL > ( self ) -> DSL
19
+ where
20
+ Back : Backend < DescriptorSetLayout = DSL > ,
21
+ {
22
+ self . vertex_layout
23
+ }
24
+ }
25
+
Original file line number Diff line number Diff line change
1
+ struct Error ;
2
+
3
+ fn foo ( ) {
4
+ let initial_exchange: Result < usize , Error > = todo ! ( ) ;
5
+ initial_exchange. and_then ( |_|
6
+ serve_udp_tunnel ( )
7
+ ) . await ;
8
+ }
9
+
10
+ async fn serve_udp_tunnel ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( type_alias_impl_trait) ]
2
+
3
+ trait Widget < E > {
4
+ type State ;
5
+
6
+ fn make_state ( & self ) -> Self :: State ;
7
+ }
8
+
9
+ impl < E > Widget < E > for ( ) {
10
+ type State = ( ) ;
11
+
12
+ fn make_state ( & self ) -> Self :: State { }
13
+ }
14
+
15
+ struct StatefulWidget < F > ( F ) ;
16
+
17
+ type StateWidget < ' a > = impl Widget < & ' a ( ) > ;
18
+
19
+ impl < F : for < ' a > Fn ( & ' a ( ) ) -> StateWidget < ' a > > Widget < ( ) > for StatefulWidget < F > {
20
+ type State = ( ) ;
21
+
22
+ fn make_state ( & self ) -> Self :: State { }
23
+ }
24
+
25
+ fn new_stateful_widget < F : for < ' a > Fn ( & ' a ( ) ) -> StateWidget < ' a > > ( build : F ) -> impl Widget < ( ) > {
26
+ StatefulWidget ( build)
27
+ }
28
+
29
+ fn main ( ) {
30
+ new_stateful_widget ( |_| ( ) ) . make_state ( ) ;
31
+ }
You can’t perform that action at this time.
0 commit comments