@@ -132,7 +132,10 @@ impl UninitializedSandbox {
132132        skip( guest_binary) ,  
133133        parent = Span :: current( )  
134134    ) ]  
135-     pub  fn  new ( guest_binary :  GuestBinary ,  cfg :  Option < SandboxConfiguration > )  -> Result < Self >  { 
135+     pub  fn  new < ' a > ( 
136+         guest_binary :  impl  std:: borrow:: Borrow < GuestBinary < ' a > > , 
137+         cfg :  Option < SandboxConfiguration > , 
138+     )  -> Result < Self >  { 
136139        #[ cfg( feature = "build-metadata" ) ]  
137140        log_build_details ( ) ; 
138141
@@ -141,12 +144,12 @@ impl UninitializedSandbox {
141144        check_windows_version ( ) ?; 
142145
143146        // If the guest binary is a file make sure it exists 
144-         let  guest_binary  = match  guest_binary { 
147+         let  guest_binary:   & GuestBinary   = match  guest_binary. borrow ( )  { 
145148            GuestBinary :: FilePath ( binary_path)  => { 
146149                let  path = Path :: new ( & binary_path) 
147150                    . canonicalize ( ) 
148151                    . map_err ( |e| new_error ! ( "GuestBinary not found: '{}': {}" ,  binary_path,  e) ) ?; 
149-                 GuestBinary :: FilePath ( 
152+                 & GuestBinary :: FilePath ( 
150153                    path. into_os_string ( ) 
151154                        . into_string ( ) 
152155                        . map_err ( |e| new_error ! ( "Error converting OsString to String: {:?}" ,  e) ) ?, 
@@ -158,7 +161,7 @@ impl UninitializedSandbox {
158161        let  sandbox_cfg = cfg. unwrap_or_default ( ) ; 
159162
160163        let  mut  mem_mgr_wrapper = { 
161-             let  mut  mgr = UninitializedSandbox :: load_guest_binary ( sandbox_cfg,  & guest_binary) ?; 
164+             let  mut  mgr = UninitializedSandbox :: load_guest_binary ( sandbox_cfg,  guest_binary) ?; 
162165            let  stack_guard = Self :: create_stack_guard ( ) ; 
163166            mgr. set_stack_guard ( & stack_guard) ?; 
164167            MemMgrWrapper :: new ( mgr,  stack_guard) 
0 commit comments