File tree Expand file tree Collapse file tree 2 files changed +21
-11
lines changed
Expand file tree Collapse file tree 2 files changed +21
-11
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri-codegen " : " patch:perf"
3+ ---
4+
5+ Wrap the generated context code in a function to make rust analyzer faster
Original file line number Diff line number Diff line change @@ -469,19 +469,24 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult<TokenStream> {
469469 } ) ;
470470
471471 Ok ( quote ! ( {
472- let thread = :: std:: thread:: Builder :: new( )
473- . name( String :: from( "generated tauri context creation" ) )
474- . stack_size( 8 * 1024 * 1024 )
475- . spawn( || #context)
476- . expect( "unable to create thread with 8MiB stack" ) ;
477-
478- match thread. join( ) {
479- Ok ( context) => context,
480- Err ( _) => {
481- eprintln!( "the generated Tauri `Context` panicked during creation" ) ;
482- :: std:: process:: exit( 101 ) ;
472+ // Wrapping in a function to make rust analyzer faster,
473+ // see https://github.com/tauri-apps/tauri/pull/14457
474+ fn inner<R : #root:: Runtime >( ) -> #root:: Context <R > {
475+ let thread = :: std:: thread:: Builder :: new( )
476+ . name( String :: from( "generated tauri context creation" ) )
477+ . stack_size( 8 * 1024 * 1024 )
478+ . spawn( || #context)
479+ . expect( "unable to create thread with 8MiB stack" ) ;
480+
481+ match thread. join( ) {
482+ Ok ( context) => context,
483+ Err ( _) => {
484+ eprintln!( "the generated Tauri `Context` panicked during creation" ) ;
485+ :: std:: process:: exit( 101 ) ;
486+ }
483487 }
484488 }
489+ inner( )
485490 } ) )
486491}
487492
You can’t perform that action at this time.
0 commit comments