pub struct Empty {}Expand description
A struct denoting an empty API request or response.
This type should serialize/deserialize in such a way that we have room to add optional fields in the future without causing old clients to reject the message (backwards-compatible changes).
Always prefer this type over () (unit) to avoid API upgrade hazards. In
JSON, unit will only deserialize from "null", meaning we can’t add new
optional fields without breaking old clients.
assert_eq!("", serde_urlencoded::to_string(&Empty {}).unwrap());
assert_eq!("{}", serde_json::to_string(&Empty {}).unwrap());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Empty
impl<'de> Deserialize<'de> for Empty
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Empty, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Empty, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Empty
impl Serialize for Empty
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Empty
Auto Trait Implementations§
impl Freeze for Empty
impl RefUnwindSafe for Empty
impl Send for Empty
impl Sync for Empty
impl Unpin for Empty
impl UnsafeUnpin for Empty
impl UnwindSafe for Empty
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more