pub struct JSON;Expand description
default implementation for deserialize a json, returning a grp_core::Error directly, very usefull for use ? in an already returning Result<T, Error>
§Example
use serde::Deserialize;
use grp_core::JSON;
#[derive(Deserialize, Clone, Debug, PartialEq)]
pub(crate) struct Version {
pub name: String,
pub version: String,
}
let version: Version = JSON::from_str(&"{\"name\":\"grp\",\"version\": \"v1.0.2\"}").unwrap();
assert_eq!(version, Version{name: "grp".to_string(), version: "v1.0.2".to_string()})Implementations§
Auto Trait Implementations§
impl Freeze for JSON
impl RefUnwindSafe for JSON
impl Send for JSON
impl Sync for JSON
impl Unpin for JSON
impl UnwindSafe for JSON
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