mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 07:08:02 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da05163d51 | |||
| f3e2bb5104 | |||
| 7a4c1086b5 | |||
| e89feb9635 | |||
| 5f72766c27 | |||
| 85ae57040d | |||
| d55a4a279f | |||
| bee9299693 | |||
| 9529fcec96 | |||
| bcec168e23 | |||
| 102a332616 | |||
| a280942f02 | |||
| 637dba5c2a | |||
| 24f292d081 | |||
| fa5c99e48a | |||
| 48f1a2c9b2 | |||
| 50ebbd63c6 | |||
| 4e5f63ff45 | |||
| de709e72a8 | |||
| 56d3c8f071 | |||
| ce89adecc1 | |||
| bc7a85063d | |||
| 0574f1e020 | |||
| f9fdd60e2e | |||
| 1c1eecabc0 | |||
| abd3fd004e | |||
| 15ee353488 | |||
| e75efbfd31 | |||
| 1c97a7ecb3 | |||
| fccd3e9fba |
@@ -48,6 +48,12 @@ matrix:
|
||||
- rust: 1.21.0
|
||||
- rust: 1.25.0
|
||||
- rust: 1.26.0
|
||||
- rust: 1.34.0
|
||||
|
||||
- rust: 1.36.0
|
||||
script:
|
||||
- cd "${TRAVIS_BUILD_DIR}/serde"
|
||||
- cargo build --no-default-features --features alloc
|
||||
|
||||
- rust: nightly
|
||||
name: Clippy
|
||||
|
||||
+2
-6
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.93" # remember to update html_root_url
|
||||
version = "1.0.95" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "A generic serialization/deserialization framework"
|
||||
@@ -48,11 +48,7 @@ unstable = []
|
||||
# Provide impls for types in the Rust core allocation and collections library
|
||||
# including String, Box<T>, Vec<T>, and Cow<T>. This is a subset of std but may
|
||||
# be enabled without depending on all of std.
|
||||
#
|
||||
# Requires a dependency on the unstable core allocation library:
|
||||
#
|
||||
# https://doc.rust-lang.org/alloc/
|
||||
alloc = ["unstable"]
|
||||
alloc = []
|
||||
|
||||
# Opt into impls for Rc<T> and Arc<T>. Serializing and deserializing these types
|
||||
# does not preserve identity and may result in multiple copies of the same data.
|
||||
|
||||
@@ -68,6 +68,10 @@ fn main() {
|
||||
if minor >= 28 {
|
||||
println!("cargo:rustc-cfg=num_nonzero");
|
||||
}
|
||||
|
||||
if minor >= 34 {
|
||||
println!("cargo:rustc-cfg=std_integer_atomics");
|
||||
}
|
||||
}
|
||||
|
||||
fn rustc_minor_version() -> Option<u32> {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use lib::*;
|
||||
|
||||
use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
||||
use de::{
|
||||
Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor,
|
||||
};
|
||||
|
||||
/// An efficient way of discarding data from a deserializer.
|
||||
///
|
||||
@@ -205,6 +207,13 @@ impl<'de> Visitor<'de> for IgnoredAny {
|
||||
let _ = bytes;
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
|
||||
fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
|
||||
where
|
||||
A: EnumAccess<'de>,
|
||||
{
|
||||
data.variant::<IgnoredAny>()?.1.newtype_variant()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for IgnoredAny {
|
||||
|
||||
+32
-2
@@ -790,7 +790,8 @@ seq_impl!(
|
||||
BinaryHeap::clear,
|
||||
BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())),
|
||||
BinaryHeap::reserve,
|
||||
BinaryHeap::push);
|
||||
BinaryHeap::push
|
||||
);
|
||||
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
seq_impl!(
|
||||
@@ -799,7 +800,8 @@ seq_impl!(
|
||||
BTreeSet::clear,
|
||||
BTreeSet::new(),
|
||||
nop_reserve,
|
||||
BTreeSet::insert);
|
||||
BTreeSet::insert
|
||||
);
|
||||
|
||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||
seq_impl!(
|
||||
@@ -2543,3 +2545,31 @@ where
|
||||
Deserialize::deserialize(deserializer).map(Wrapping)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics))]
|
||||
macro_rules! atomic_impl {
|
||||
($($ty:ident)*) => {
|
||||
$(
|
||||
impl<'de> Deserialize<'de> for $ty {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Deserialize::deserialize(deserializer).map(Self::new)
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics))]
|
||||
atomic_impl! {
|
||||
AtomicBool
|
||||
AtomicI8 AtomicI16 AtomicI32 AtomicIsize
|
||||
AtomicU8 AtomicU16 AtomicU32 AtomicUsize
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))]
|
||||
atomic_impl! {
|
||||
AtomicI64 AtomicU64
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/// Conditional compilation depending on whether Serde is built with support for
|
||||
/// 128-bit integers.
|
||||
///
|
||||
/// Data formats that wish to support Rust compiler versions older than 1.26 may
|
||||
/// place the i128 / u128 methods of their Serializer and Deserializer behind
|
||||
/// this macro.
|
||||
/// Data formats that wish to support Rust compiler versions older than 1.26
|
||||
/// (or targets that lack 128-bit integers) may place the i128 / u128 methods
|
||||
/// of their Serializer and Deserializer behind this macro.
|
||||
///
|
||||
/// Data formats that require a minimum Rust compiler version of at least 1.26
|
||||
/// do not need to bother with this macro and may assume support for 128-bit
|
||||
/// integers.
|
||||
/// Data formats that require a minimum Rust compiler version of at least 1.26,
|
||||
/// or do not target platforms that lack 128-bit integers, do not need to
|
||||
/// bother with this macro and may assume support for 128-bit integers.
|
||||
///
|
||||
/// ```edition2018
|
||||
/// # use serde::private::ser::Error;
|
||||
|
||||
+9
-1
@@ -73,7 +73,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.93")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.95")]
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// Unstable functionality only if the user asks for it. For tracking and
|
||||
@@ -212,6 +212,14 @@ mod lib {
|
||||
#[cfg(range_inclusive)]
|
||||
pub use self::core::ops::RangeInclusive;
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics))]
|
||||
pub use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
||||
AtomicUsize, Ordering,
|
||||
};
|
||||
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))]
|
||||
pub use std::sync::atomic::{AtomicI64, AtomicU64};
|
||||
|
||||
#[cfg(any(core_duration, feature = "std"))]
|
||||
pub use self::core::time::Duration;
|
||||
}
|
||||
|
||||
@@ -620,6 +620,7 @@ impl Serialize for SystemTime {
|
||||
#[cfg(feature = "std")]
|
||||
macro_rules! serialize_display_bounded_length {
|
||||
($value:expr, $max:expr, $serializer:expr) => {{
|
||||
#[allow(deprecated)]
|
||||
let mut buffer: [u8; $max] = unsafe { mem::uninitialized() };
|
||||
let remaining_len = {
|
||||
let mut remaining = &mut buffer[..];
|
||||
@@ -838,3 +839,33 @@ where
|
||||
self.0.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics))]
|
||||
macro_rules! atomic_impl {
|
||||
($($ty:ident)*) => {
|
||||
$(
|
||||
impl Serialize for $ty {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
self.load(Ordering::SeqCst).serialize(serializer)
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics))]
|
||||
atomic_impl! {
|
||||
AtomicBool
|
||||
AtomicI8 AtomicI16 AtomicI32 AtomicIsize
|
||||
AtomicU8 AtomicU16 AtomicU32 AtomicUsize
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))]
|
||||
atomic_impl! {
|
||||
AtomicI64 AtomicU64
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.93" # remember to update html_root_url
|
||||
version = "1.0.95" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.93")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.95")]
|
||||
#![allow(unknown_lints, bare_trait_objects)]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_test"
|
||||
version = "1.0.93" # remember to update html_root_url
|
||||
version = "1.0.95" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.93")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.95")]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Ignored clippy lints
|
||||
|
||||
@@ -14,7 +14,7 @@ serde = { path = "../serde" }
|
||||
[dev-dependencies]
|
||||
fnv = "1.0"
|
||||
rustc-serialize = "0.3.16"
|
||||
select-rustc = "0.1"
|
||||
rustversion = "0.1"
|
||||
serde = { path = "../serde", features = ["rc", "derive"] }
|
||||
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] }
|
||||
serde_test = { path = "../serde_test" }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
#[rustc::attr(not(nightly), ignore)]
|
||||
#[rustversion::attr(not(nightly), ignore)]
|
||||
#[test]
|
||||
fn ui() {
|
||||
let t = trybuild::TestCases::new();
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
#![allow(clippy::decimal_literal_representation)]
|
||||
#![allow(clippy::decimal_literal_representation, clippy::unreadable_literal)]
|
||||
#![cfg_attr(feature = "unstable", feature(never_type))]
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
use std::default::Default;
|
||||
use std::ffi::{CStr, CString, OsString};
|
||||
use std::fmt::Debug;
|
||||
use std::net;
|
||||
use std::num::Wrapping;
|
||||
use std::ops::Bound;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::rc::{Rc, Weak as RcWeak};
|
||||
use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
||||
AtomicUsize, Ordering,
|
||||
};
|
||||
use std::sync::{Arc, Weak as ArcWeak};
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
use std::sync::atomic::{AtomicI64, AtomicU64};
|
||||
|
||||
use fnv::FnvHasher;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use serde_test::{assert_de_tokens, assert_de_tokens_error, Configure, Token};
|
||||
|
||||
@@ -124,6 +133,19 @@ enum EnumOther {
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
struct IgnoredAny;
|
||||
|
||||
impl<'de> Deserialize<'de> for IgnoredAny {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
serde::de::IgnoredAny::deserialize(deserializer)?;
|
||||
Ok(IgnoredAny)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
macro_rules! declare_tests {
|
||||
@@ -929,6 +951,21 @@ declare_tests! {
|
||||
Token::SeqEnd,
|
||||
],
|
||||
}
|
||||
test_ignored_any {
|
||||
IgnoredAny => &[
|
||||
Token::Str("s"),
|
||||
],
|
||||
IgnoredAny => &[
|
||||
Token::Seq { len: Some(1) },
|
||||
Token::Bool(true),
|
||||
Token::SeqEnd,
|
||||
],
|
||||
IgnoredAny => &[
|
||||
Token::Enum { name: "E" },
|
||||
Token::Str("Rust"),
|
||||
Token::Unit,
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
declare_tests! {
|
||||
@@ -1112,6 +1149,45 @@ fn test_never_type() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_atomics() {
|
||||
fn test<L, A, T>(load: L, val: T, token: Token)
|
||||
where
|
||||
L: Fn(&A, Ordering) -> T,
|
||||
A: DeserializeOwned,
|
||||
T: PartialEq + Debug,
|
||||
{
|
||||
let tokens = &[token];
|
||||
let mut de = serde_test::Deserializer::new(tokens);
|
||||
match A::deserialize(&mut de) {
|
||||
Ok(v) => {
|
||||
let loaded = load(&v, Ordering::SeqCst);
|
||||
assert_eq!(val, loaded);
|
||||
}
|
||||
Err(e) => panic!("tokens failed to deserialize: {}", e),
|
||||
};
|
||||
if de.remaining() > 0 {
|
||||
panic!("{} remaining tokens", de.remaining());
|
||||
}
|
||||
}
|
||||
|
||||
test(AtomicBool::load, true, Token::Bool(true));
|
||||
test(AtomicI8::load, -127, Token::I8(-127i8));
|
||||
test(AtomicI16::load, -510, Token::I16(-510i16));
|
||||
test(AtomicI32::load, -131072, Token::I32(-131072i32));
|
||||
test(AtomicIsize::load, -131072isize, Token::I32(-131072));
|
||||
test(AtomicU8::load, 127, Token::U8(127u8));
|
||||
test(AtomicU16::load, 510u16, Token::U16(510u16));
|
||||
test(AtomicU32::load, 131072u32, Token::U32(131072u32));
|
||||
test(AtomicUsize::load, 131072usize, Token::U32(131072));
|
||||
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
{
|
||||
test(AtomicI64::load, -8589934592, Token::I64(-8589934592));
|
||||
test(AtomicU64::load, 8589934592u64, Token::U64(8589934592));
|
||||
}
|
||||
}
|
||||
|
||||
declare_error_tests! {
|
||||
test_unknown_field<StructDenyUnknown> {
|
||||
&[
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
use serde::de::value::{Error, MapDeserializer, SeqDeserializer};
|
||||
use serde::de::{
|
||||
DeserializeSeed, EnumAccess, IgnoredAny, IntoDeserializer, VariantAccess, Visitor,
|
||||
};
|
||||
use serde::{forward_to_deserialize_any, Deserialize, Deserializer};
|
||||
|
||||
#[derive(PartialEq, Debug, Deserialize)]
|
||||
enum Target {
|
||||
Unit,
|
||||
Newtype(i32),
|
||||
Tuple(i32, i32),
|
||||
Struct { a: i32 },
|
||||
}
|
||||
|
||||
struct Enum(&'static str);
|
||||
|
||||
impl<'de> Deserializer<'de> for Enum {
|
||||
type Error = Error;
|
||||
|
||||
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
visitor.visit_enum(self)
|
||||
}
|
||||
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string
|
||||
bytes byte_buf option unit unit_struct newtype_struct seq tuple
|
||||
tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> EnumAccess<'de> for Enum {
|
||||
type Error = Error;
|
||||
type Variant = Self;
|
||||
|
||||
fn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant), Self::Error>
|
||||
where
|
||||
V: DeserializeSeed<'de>,
|
||||
{
|
||||
let v = seed.deserialize(self.0.into_deserializer())?;
|
||||
Ok((v, self))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> VariantAccess<'de> for Enum {
|
||||
type Error = Error;
|
||||
|
||||
fn unit_variant(self) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn newtype_variant_seed<T>(self, seed: T) -> Result<T::Value, Self::Error>
|
||||
where
|
||||
T: DeserializeSeed<'de>,
|
||||
{
|
||||
seed.deserialize(10i32.into_deserializer())
|
||||
}
|
||||
|
||||
fn tuple_variant<V>(self, _len: usize, visitor: V) -> Result<V::Value, Self::Error>
|
||||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
let seq = SeqDeserializer::new(vec![1i32, 2].into_iter());
|
||||
visitor.visit_seq(seq)
|
||||
}
|
||||
|
||||
fn struct_variant<V>(
|
||||
self,
|
||||
_fields: &'static [&'static str],
|
||||
visitor: V,
|
||||
) -> Result<V::Value, Self::Error>
|
||||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
let map = MapDeserializer::new(vec![("a", 10i32)].into_iter());
|
||||
visitor.visit_map(map)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_enum() {
|
||||
// First just make sure the Deserializer impl works
|
||||
assert_eq!(Target::Unit, Target::deserialize(Enum("Unit")).unwrap());
|
||||
assert_eq!(
|
||||
Target::Newtype(10),
|
||||
Target::deserialize(Enum("Newtype")).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
Target::Tuple(1, 2),
|
||||
Target::deserialize(Enum("Tuple")).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
Target::Struct { a: 10 },
|
||||
Target::deserialize(Enum("Struct")).unwrap()
|
||||
);
|
||||
|
||||
// Now try IgnoredAny
|
||||
IgnoredAny::deserialize(Enum("Unit")).unwrap();
|
||||
IgnoredAny::deserialize(Enum("Newtype")).unwrap();
|
||||
IgnoredAny::deserialize(Enum("Tuple")).unwrap();
|
||||
IgnoredAny::deserialize(Enum("Struct")).unwrap();
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(clippy::unreadable_literal)]
|
||||
#![cfg_attr(feature = "unstable", feature(never_type))]
|
||||
|
||||
use std::cell::RefCell;
|
||||
@@ -9,11 +10,17 @@ use std::num::Wrapping;
|
||||
use std::ops::Bound;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::rc::{Rc, Weak as RcWeak};
|
||||
use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
||||
AtomicUsize,
|
||||
};
|
||||
use std::sync::{Arc, Weak as ArcWeak};
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::str;
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
use std::sync::atomic::{AtomicI64, AtomicU64};
|
||||
|
||||
use fnv::FnvHasher;
|
||||
use serde::Serialize;
|
||||
@@ -483,6 +490,26 @@ declare_tests! {
|
||||
Token::Str("1a"),
|
||||
],
|
||||
}
|
||||
test_atomic {
|
||||
AtomicBool::new(false) => &[Token::Bool(false)],
|
||||
AtomicBool::new(true) => &[Token::Bool(true)],
|
||||
AtomicI8::new(63i8) => &[Token::I8(63i8)],
|
||||
AtomicI16::new(-318i16) => &[Token::I16(-318i16)],
|
||||
AtomicI32::new(65792i32) => &[Token::I32(65792i32)],
|
||||
AtomicIsize::new(-65792isize) => &[Token::I64(-65792i64)],
|
||||
AtomicU8::new(192u8) => &[Token::U8(192u8)],
|
||||
AtomicU16::new(510u16) => &[Token::U16(510u16)],
|
||||
AtomicU32::new(131072u32) => &[Token::U32(131072u32)],
|
||||
AtomicUsize::new(655360usize) => &[Token::U64(655360u64)],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
declare_tests! {
|
||||
test_atomic64 {
|
||||
AtomicI64::new(-4295032832i64) => &[Token::I64(-4295032832i64)],
|
||||
AtomicU64::new(12884901888u64) => &[Token::U64(12884901888u64)],
|
||||
}
|
||||
}
|
||||
|
||||
declare_tests! {
|
||||
|
||||
Reference in New Issue
Block a user