We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Cow<str>
Cow<CStr>
1 parent 5872ed7 commit 3ab3c99Copy full SHA for 3ab3c99
1 file changed
src/conversion.rs
@@ -523,7 +523,10 @@ impl IntoLua for &str {
523
impl IntoLua for Cow<'_, str> {
524
#[inline]
525
fn into_lua(self, lua: &Lua) -> Result<Value> {
526
- Ok(Value::String(lua.create_string(self.as_bytes())?))
+ match self {
527
+ Cow::Borrowed(s) => s.into_lua(lua),
528
+ Cow::Owned(s) => s.into_lua(lua),
529
+ }
530
}
531
532
@@ -585,7 +588,10 @@ impl IntoLua for &CStr {
585
588
impl IntoLua for Cow<'_, CStr> {
586
589
587
590
- Ok(Value::String(lua.create_string(self.to_bytes())?))
591
592
593
594
595
596
597
0 commit comments