File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -368,23 +368,20 @@ impl<'a> IntoIterator for BorrowedBytes<'a> {
368
368
}
369
369
}
370
370
371
- pub ( crate ) struct WrappedString < F : FnOnce ( & Lua ) -> Result < String > > ( F ) ;
371
+ pub ( crate ) struct WrappedString < T : AsRef < [ u8 ] > > ( T ) ;
372
372
373
373
impl String {
374
374
/// Wraps bytes, returning an opaque type that implements [`IntoLua`] trait.
375
375
///
376
376
/// This function uses [`Lua::create_string`] under the hood.
377
377
pub fn wrap ( data : impl AsRef < [ u8 ] > ) -> impl IntoLua {
378
- WrappedString ( move |lua| lua . create_string ( data) )
378
+ WrappedString ( data)
379
379
}
380
380
}
381
381
382
- impl < F > IntoLua for WrappedString < F >
383
- where
384
- F : FnOnce ( & Lua ) -> Result < String > ,
385
- {
382
+ impl < T : AsRef < [ u8 ] > > IntoLua for WrappedString < T > {
386
383
fn into_lua ( self , lua : & Lua ) -> Result < Value > {
387
- ( self . 0 ) ( lua ) . map ( Value :: String )
384
+ lua . create_string ( self . 0 ) . map ( Value :: String )
388
385
}
389
386
}
390
387
You can’t perform that action at this time.
0 commit comments