Implement traits for !
This commit is contained in:
parent
0a71fe329c
commit
338fb67853
@ -49,6 +49,16 @@ impl<'de> Deserialize<'de> for () {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
impl<'de> Deserialize<'de> for ! {
|
||||
fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Err(Error::custom("cannot deserialize `!`"))
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct BoolVisitor;
|
||||
|
@ -98,6 +98,7 @@
|
||||
//! - PathBuf
|
||||
//! - Range\<T\>
|
||||
//! - num::NonZero*
|
||||
//! - `!` *(unstable)*
|
||||
//! - **Net types**:
|
||||
//! - IpAddr
|
||||
//! - Ipv4Addr
|
||||
|
@ -89,7 +89,7 @@
|
||||
// discussion of these features please refer to this issue:
|
||||
//
|
||||
// https://github.com/serde-rs/serde/issues/812
|
||||
#![cfg_attr(feature = "unstable", feature(specialization))]
|
||||
#![cfg_attr(feature = "unstable", feature(specialization, never_type))]
|
||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Whitelisted clippy lints
|
||||
|
@ -247,6 +247,16 @@ impl Serialize for () {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
impl Serialize for ! {
|
||||
fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
macro_rules! tuple_impls {
|
||||
|
@ -93,6 +93,7 @@
|
||||
//! - PathBuf
|
||||
//! - Range\<T\>
|
||||
//! - num::NonZero*
|
||||
//! - `!` *(unstable)*
|
||||
//! - **Net types**:
|
||||
//! - IpAddr
|
||||
//! - Ipv4Addr
|
||||
|
Loading…
x
Reference in New Issue
Block a user