@@ -262,13 +262,14 @@ impl CppMethod {
262262 let params = self . write_params ( config) ;
263263 let generics = self . write_generics ( ) ;
264264 let abi_return_type = self . write_return ( config) ;
265+ let result = config. write_result ( ) ;
265266
266267 match self . return_hint {
267268 ReturnHint :: Query ( ..) => {
268269 let where_clause = self . write_where ( config, true ) ;
269270
270271 quote ! {
271- pub unsafe fn #name<#generics T >( & self , #params) -> windows_core :: Result <T > #where_clause {
272+ pub unsafe fn #name<#generics T >( & self , #params) -> #result Result <T > #where_clause {
272273 let mut result__ = core:: ptr:: null_mut( ) ;
273274 unsafe { ( windows_core:: Interface :: vtable( self ) . #vname) ( windows_core:: Interface :: as_raw( self ) , #args) . and_then( ||windows_core:: Type :: from_abi( result__) ) }
274275 }
@@ -278,7 +279,7 @@ impl CppMethod {
278279 let where_clause = self . write_where ( config, true ) ;
279280
280281 quote ! {
281- pub unsafe fn #name<#generics T >( & self , #params result__: * mut Option <T >) -> windows_core :: Result <( ) > #where_clause {
282+ pub unsafe fn #name<#generics T >( & self , #params result__: * mut Option <T >) -> #result Result <( ) > #where_clause {
282283 unsafe { ( windows_core:: Interface :: vtable( self ) . #vname) ( windows_core:: Interface :: as_raw( self ) , #args) . ok( ) }
283284 }
284285 }
@@ -292,7 +293,7 @@ impl CppMethod {
292293 let return_type = return_type. write_name ( config) ;
293294
294295 quote ! {
295- pub unsafe fn #name<#generics>( & self , #params) -> windows_core :: Result <#return_type> #where_clause {
296+ pub unsafe fn #name<#generics>( & self , #params) -> #result Result <#return_type> #where_clause {
296297 unsafe {
297298 let mut result__ = core:: mem:: zeroed( ) ;
298299 ( windows_core:: Interface :: vtable( self ) . #vname) ( windows_core:: Interface :: as_raw( self ) , #args) . #map
@@ -304,7 +305,7 @@ impl CppMethod {
304305 let where_clause = self . write_where ( config, false ) ;
305306
306307 quote ! {
307- pub unsafe fn #name<#generics>( & self , #params) -> windows_core :: Result <( ) > #where_clause {
308+ pub unsafe fn #name<#generics>( & self , #params) -> #result Result <( ) > #where_clause {
308309 unsafe { ( windows_core:: Interface :: vtable( self ) . #vname) ( windows_core:: Interface :: as_raw( self ) , #args) . ok( ) }
309310 }
310311 }
@@ -318,7 +319,7 @@ impl CppMethod {
318319 let return_type = return_type. write_name ( config) ;
319320
320321 quote ! {
321- pub unsafe fn #name<#generics>( & self , #params) -> windows_core :: Result <#return_type> #where_clause {
322+ pub unsafe fn #name<#generics>( & self , #params) -> #result Result <#return_type> #where_clause {
322323 unsafe {
323324 let mut result__ = core:: mem:: zeroed( ) ;
324325 ( windows_core:: Interface :: vtable( self ) . #vname) ( windows_core:: Interface :: as_raw( self ) , #args) ;
@@ -441,15 +442,17 @@ impl CppMethod {
441442 }
442443 }
443444
445+ let result = config. write_result ( ) ;
446+
444447 let return_type = match self . return_hint {
445448 ReturnHint :: Query ( ..) | ReturnHint :: QueryOptional ( ..) | ReturnHint :: ResultVoid => {
446- quote ! { -> windows_core :: Result <( ) > }
449+ quote ! { -> #result Result <( ) > }
447450 }
448451 ReturnHint :: ResultValue => {
449452 let return_type = self . signature . params [ self . signature . params . len ( ) - 1 ] . deref ( ) ;
450453 let return_type = return_type. write_name ( config) ;
451454
452- quote ! { -> windows_core :: Result <#return_type> }
455+ quote ! { -> #result Result <#return_type> }
453456 }
454457 _ => self . write_return ( config) ,
455458 } ;
0 commit comments