pub struct JSON<T: JSONValue>(pub T);
Expand description
Encapsulates a JSONValue and implements useful traits.
§Examples
use json_in_type::JSON;
let x_json = JSON(vec![(), (), ()]);
assert_eq!("[null,null,null]", x_json.to_string()); // JSON format
println!("{}", x_json); // just works. Displays [null,null,null]
let my_buffer : Vec<u8> = x_json.into();
assert_eq!(b"[null,null,null]".to_vec(), my_buffer);
Tuple Fields§
§0: T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for JSON<T>where
T: Freeze,
impl<T> RefUnwindSafe for JSON<T>where
T: RefUnwindSafe,
impl<T> Send for JSON<T>where
T: Send,
impl<T> Sync for JSON<T>where
T: Sync,
impl<T> Unpin for JSON<T>where
T: Unpin,
impl<T> UnwindSafe for JSON<T>where
T: UnwindSafe,
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