pub struct RawJson<'a> { /* private fields */ }Expand description
A validated JSON value borrowed directly from the input buffer.
RawJson is useful for protocol envelopes that need to inspect a few
fields while deferring or avoiding deserialization of a large payload.
Capturing it performs no allocation and preserves the exact compact or
pretty representation from the input.
Implementations§
Source§impl<'a> RawJson<'a>
impl<'a> RawJson<'a>
Sourcepub fn deserialize<T>(self) -> Result<T>where
T: Deserialize<'a>,
pub fn deserialize<T>(self) -> Result<T>where
T: Deserialize<'a>,
Deserializes the captured value only when the caller needs it.
§Errors
Returns an error when the JSON does not match T.
Trait Implementations§
impl<'a> Copy for RawJson<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for RawJson<'a>
impl<'de: 'a, 'a> Deserialize<'de> for RawJson<'a>
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
impl<'a> Eq for RawJson<'a>
impl<'a> StructuralPartialEq for RawJson<'a>
Auto Trait Implementations§
impl<'a> Freeze for RawJson<'a>
impl<'a> RefUnwindSafe for RawJson<'a>
impl<'a> Send for RawJson<'a>
impl<'a> Sync for RawJson<'a>
impl<'a> Unpin for RawJson<'a>
impl<'a> UnsafeUnpin for RawJson<'a>
impl<'a> UnwindSafe for RawJson<'a>
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