mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 06:27:59 +00:00
Serialize unsized RefCell, Mutex and RwLock
This commit is contained in:
@@ -13,7 +13,7 @@ use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
||||
AtomicUsize,
|
||||
};
|
||||
use std::sync::{Arc, Weak as ArcWeak};
|
||||
use std::sync::{Arc, Mutex, RwLock, Weak as ArcWeak};
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
|
||||
#[cfg(unix)]
|
||||
@@ -847,3 +847,39 @@ fn test_integer128() {
|
||||
|
||||
assert_ser_tokens_error(&1u128, &[], "u128 is not supported");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_refcell_dst() {
|
||||
assert_ser_tokens(
|
||||
&RefCell::new([true]) as &RefCell<[bool]>,
|
||||
&[
|
||||
Token::Seq { len: Some(1) },
|
||||
Token::Bool(true),
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutex_dst() {
|
||||
assert_ser_tokens(
|
||||
&Mutex::new([true]) as &Mutex<[bool]>,
|
||||
&[
|
||||
Token::Seq { len: Some(1) },
|
||||
Token::Bool(true),
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rwlock_dst() {
|
||||
assert_ser_tokens(
|
||||
&RwLock::new([true]) as &RwLock<[bool]>,
|
||||
&[
|
||||
Token::Seq { len: Some(1) },
|
||||
Token::Bool(true),
|
||||
Token::SeqEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user