@@ -22,7 +22,8 @@ use crate::value::{FromLua, IntoLua, Nil, Value};
2222
2323#[ cfg( all( feature = "unstable" , any( not( feature = "send" ) , doc) ) ) ]
2424use crate :: {
25- function:: OwnedFunction , table:: OwnedTable , thread:: OwnedThread , userdata:: OwnedAnyUserData ,
25+ function:: OwnedFunction , string:: OwnedString , table:: OwnedTable , thread:: OwnedThread ,
26+ userdata:: OwnedAnyUserData ,
2627} ;
2728
2829impl < ' lua > IntoLua < ' lua > for Value < ' lua > {
@@ -71,6 +72,38 @@ impl<'lua> FromLua<'lua> for String<'lua> {
7172 }
7273}
7374
75+ #[ cfg( all( feature = "unstable" , any( not( feature = "send" ) , doc) ) ) ]
76+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "unstable" , not( feature = "send" ) ) ) ) ) ]
77+ impl < ' lua > IntoLua < ' lua > for OwnedString {
78+ #[ inline]
79+ fn into_lua ( self , lua : & ' lua Lua ) -> Result < Value < ' lua > > {
80+ Ok ( Value :: String ( String ( lua. adopt_owned_ref ( self . 0 ) ) ) )
81+ }
82+ }
83+
84+ #[ cfg( all( feature = "unstable" , any( not( feature = "send" ) , doc) ) ) ]
85+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "unstable" , not( feature = "send" ) ) ) ) ) ]
86+ impl < ' lua > IntoLua < ' lua > for & OwnedString {
87+ #[ inline]
88+ fn into_lua ( self , lua : & ' lua Lua ) -> Result < Value < ' lua > > {
89+ OwnedString :: into_lua ( self . clone ( ) , lua)
90+ }
91+
92+ #[ inline]
93+ unsafe fn push_into_stack ( self , lua : & ' lua Lua ) -> Result < ( ) > {
94+ Ok ( lua. push_owned_ref ( & self . 0 ) )
95+ }
96+ }
97+
98+ #[ cfg( all( feature = "unstable" , any( not( feature = "send" ) , doc) ) ) ]
99+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "unstable" , not( feature = "send" ) ) ) ) ) ]
100+ impl < ' lua > FromLua < ' lua > for OwnedString {
101+ #[ inline]
102+ fn from_lua ( value : Value < ' lua > , lua : & ' lua Lua ) -> Result < OwnedString > {
103+ String :: from_lua ( value, lua) . map ( |s| s. into_owned ( ) )
104+ }
105+ }
106+
74107impl < ' lua > IntoLua < ' lua > for Table < ' lua > {
75108 #[ inline]
76109 fn into_lua ( self , _: & ' lua Lua ) -> Result < Value < ' lua > > {
0 commit comments