pub struct Empty(/* private fields */);Expand description
Type representing an empty JSON object
This type is used when you want to output an empty JSON object {} in JSON serialization,
and accept any JSON object when deserializing, but its content is ignored.
§Example
use mcp_attr::utils::Empty;
use serde_json::json;
let empty = Empty::default();
let json = json!(empty);
assert_eq!(json, json!({}));
let empty: Empty = serde_json::from_value(json!({ "key": "value" })).unwrap();
let json = json!(empty);
assert_eq!(json, json!({}));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Empty
impl<'de> Deserialize<'de> for Empty
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Empty
impl RefUnwindSafe for Empty
impl Send for Empty
impl Sync for Empty
impl Unpin 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