44#![ feature( try_trait_v2) ]
55#![ feature( try_trait_v2_residual) ]
66//@no-rustfix
7- use std:: ops:: { ControlFlow , FromResidual , Residual , Try } ;
7+ use std:: ops:: { ControlFlow , FromResidual , Residual , Try , FromOutput , Branch } ;
88
99#[ macro_use]
1010extern crate proc_macros;
@@ -24,19 +24,20 @@ impl Residual<()> for NotOptionResidual {
2424 type TryType = NotOption ;
2525}
2626
27- impl Try for NotOption {
27+ impl Branch for NotOption {
2828 type Output = ( ) ;
2929 type Residual = NotOptionResidual ;
3030
31- fn from_output ( _ : Self :: Output ) -> Self {
31+ fn branch ( self ) -> ControlFlow < Self :: Residual , Self :: Output > {
3232 todo ! ( )
3333 }
34+ }
3435
35- fn branch ( self ) -> ControlFlow < Self :: Residual , Self :: Output > {
36+ impl FromOutput for NotOption {
37+ fn from_output ( _: Self :: Output ) -> Self {
3638 todo ! ( )
3739 }
3840}
39-
4041// Test custom `Try` with only 1 argument
4142#[ derive( Default ) ]
4243struct NotOptionButWorse ( i32 ) ;
@@ -53,15 +54,17 @@ impl Residual<()> for NotOptionButWorseResidual {
5354 type TryType = NotOptionButWorse ;
5455}
5556
56- impl Try for NotOptionButWorse {
57+ impl Branch for NotOptionButWorse {
5758 type Output = ( ) ;
5859 type Residual = NotOptionButWorseResidual ;
5960
60- fn from_output ( _ : Self :: Output ) -> Self {
61+ fn branch ( self ) -> ControlFlow < Self :: Residual , Self :: Output > {
6162 todo ! ( )
6263 }
64+ }
6365
64- fn branch ( self ) -> ControlFlow < Self :: Residual , Self :: Output > {
66+ impl FromOutput for NotOptionButWorse {
67+ fn from_output ( _: Self :: Output ) -> Self {
6568 todo ! ( )
6669 }
6770}
0 commit comments