mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 15:25:38 +00:00
Update atomic_impl macros to have same input syntax in all cfgs
This commit is contained in:
parent
37faaf295e
commit
0d79306285
@ -2662,7 +2662,7 @@ where
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||||
macro_rules! atomic_impl {
|
macro_rules! atomic_impl {
|
||||||
($($ty:ident)*) => {
|
($($ty:ident $size:expr)*) => {
|
||||||
$(
|
$(
|
||||||
impl<'de> Deserialize<'de> for $ty {
|
impl<'de> Deserialize<'de> for $ty {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
@ -2678,7 +2678,7 @@ macro_rules! atomic_impl {
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
||||||
macro_rules! atomic_impl {
|
macro_rules! atomic_impl {
|
||||||
($($ty:ident $size:expr),*) => {
|
($($ty:ident $size:expr)*) => {
|
||||||
$(
|
$(
|
||||||
#[cfg(target_has_atomic = $size)]
|
#[cfg(target_has_atomic = $size)]
|
||||||
impl<'de> Deserialize<'de> for $ty {
|
impl<'de> Deserialize<'de> for $ty {
|
||||||
@ -2695,28 +2695,35 @@ macro_rules! atomic_impl {
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicBool
|
AtomicBool "8"
|
||||||
AtomicI8 AtomicI16 AtomicI32 AtomicIsize
|
AtomicI8 "8"
|
||||||
AtomicU8 AtomicU16 AtomicU32 AtomicUsize
|
AtomicI16 "16"
|
||||||
|
AtomicI32 "32"
|
||||||
|
AtomicIsize "ptr"
|
||||||
|
AtomicU8 "8"
|
||||||
|
AtomicU16 "16"
|
||||||
|
AtomicU32 "32"
|
||||||
|
AtomicUsize "ptr"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicI64 AtomicU64
|
AtomicI64 "64"
|
||||||
|
AtomicU64 "64"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicBool "8",
|
AtomicBool "8"
|
||||||
AtomicI8 "8",
|
AtomicI8 "8"
|
||||||
AtomicI16 "16",
|
AtomicI16 "16"
|
||||||
AtomicI32 "32",
|
AtomicI32 "32"
|
||||||
AtomicI64 "64",
|
AtomicI64 "64"
|
||||||
AtomicIsize "ptr",
|
AtomicIsize "ptr"
|
||||||
AtomicU8 "8",
|
AtomicU8 "8"
|
||||||
AtomicU16 "16",
|
AtomicU16 "16"
|
||||||
AtomicU32 "32",
|
AtomicU32 "32"
|
||||||
AtomicU64 "64",
|
AtomicU64 "64"
|
||||||
AtomicUsize "ptr"
|
AtomicUsize "ptr"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,7 +947,7 @@ where
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||||
macro_rules! atomic_impl {
|
macro_rules! atomic_impl {
|
||||||
($($ty:ident)*) => {
|
($($ty:ident $size:expr)*) => {
|
||||||
$(
|
$(
|
||||||
impl Serialize for $ty {
|
impl Serialize for $ty {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
@ -964,7 +964,7 @@ macro_rules! atomic_impl {
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
||||||
macro_rules! atomic_impl {
|
macro_rules! atomic_impl {
|
||||||
($($ty:ident $size:expr),*) => {
|
($($ty:ident $size:expr)*) => {
|
||||||
$(
|
$(
|
||||||
#[cfg(target_has_atomic = $size)]
|
#[cfg(target_has_atomic = $size)]
|
||||||
impl Serialize for $ty {
|
impl Serialize for $ty {
|
||||||
@ -982,27 +982,34 @@ macro_rules! atomic_impl {
|
|||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicBool
|
AtomicBool "8"
|
||||||
AtomicI8 AtomicI16 AtomicI32 AtomicIsize
|
AtomicI8 "8"
|
||||||
AtomicU8 AtomicU16 AtomicU32 AtomicUsize
|
AtomicI16 "16"
|
||||||
|
AtomicI32 "32"
|
||||||
|
AtomicIsize "ptr"
|
||||||
|
AtomicU8 "8"
|
||||||
|
AtomicU16 "16"
|
||||||
|
AtomicU32 "32"
|
||||||
|
AtomicUsize "ptr"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
|
#[cfg(all(feature = "std", no_target_has_atomic, not(no_std_atomic64)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicI64 AtomicU64
|
AtomicI64 "64"
|
||||||
|
AtomicU64 "64"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
#[cfg(all(feature = "std", not(no_target_has_atomic)))]
|
||||||
atomic_impl! {
|
atomic_impl! {
|
||||||
AtomicBool "8",
|
AtomicBool "8"
|
||||||
AtomicI8 "8",
|
AtomicI8 "8"
|
||||||
AtomicI16 "16",
|
AtomicI16 "16"
|
||||||
AtomicI32 "32",
|
AtomicI32 "32"
|
||||||
AtomicI64 "64",
|
AtomicI64 "64"
|
||||||
AtomicIsize "ptr",
|
AtomicIsize "ptr"
|
||||||
AtomicU8 "8",
|
AtomicU8 "8"
|
||||||
AtomicU16 "16",
|
AtomicU16 "16"
|
||||||
AtomicU32 "32",
|
AtomicU32 "32"
|
||||||
AtomicU64 "64",
|
AtomicU64 "64"
|
||||||
AtomicUsize "ptr"
|
AtomicUsize "ptr"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user