Skip to content

Commit a01b032

Browse files
committed
Add bstr/serde dependency if serialize feature flag is enabled
1 parent 18497f1 commit a01b032

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module = ["dep:mlua_derive", "ffi/module"]
4040
async = ["dep:futures-util"]
4141
send = ["parking_lot/send_guard", "error-send"]
4242
error-send = []
43-
serialize = ["dep:serde", "dep:erased-serde", "dep:serde-value"]
43+
serialize = ["dep:serde", "dep:erased-serde", "dep:serde-value", "bstr/serde"]
4444
macros = ["mlua_derive/macros"]
4545
anyhow = ["dep:anyhow", "error-send"]
4646
userdata-wrappers = []

tests/serde.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::collections::HashMap;
44
use std::error::Error as StdError;
55

6+
use bstr::BString;
67
use mlua::{
78
AnyUserData, DeserializeOptions, Error, ExternalResult, IntoLua, Lua, LuaSerdeExt, Result as LuaResult,
89
SerializeOptions, UserData, Value,
@@ -420,6 +421,7 @@ fn test_from_value_struct() -> Result<(), Box<dyn StdError>> {
420421
map: HashMap<i32, i32>,
421422
empty: Vec<()>,
422423
tuple: (u8, u8, u8),
424+
bytes: BString,
423425
}
424426

425427
let value = lua
@@ -431,6 +433,7 @@ fn test_from_value_struct() -> Result<(), Box<dyn StdError>> {
431433
map = {2, [4] = 1},
432434
empty = {},
433435
tuple = {10, 20, 30},
436+
bytes = "\240\040\140\040",
434437
}
435438
"#,
436439
)
@@ -443,6 +446,7 @@ fn test_from_value_struct() -> Result<(), Box<dyn StdError>> {
443446
map: vec![(1, 2), (4, 1)].into_iter().collect(),
444447
empty: vec![],
445448
tuple: (10, 20, 30),
449+
bytes: BString::from([240, 40, 140, 40]),
446450
},
447451
got
448452
);

0 commit comments

Comments
 (0)