pub struct Deserializer<R> { /* private fields */ }Expand description
A Deserializer can deserialize input data from a reader into a Value.
Implementations§
Source§impl<R> Deserializer<R>where
R: Read,
impl<R> Deserializer<R>where
R: Read,
Sourcepub fn with_options(reader: R, opts: DeserializeOptions) -> Self
pub fn with_options(reader: R, opts: DeserializeOptions) -> Self
Creates a new Deserializer for reader with options.
Sourcepub fn deserialize(&mut self, encoding: Encoding) -> Result<Value>
pub fn deserialize(&mut self, encoding: Encoding) -> Result<Value>
Reads input data from the given reader and deserializes it in a Value.
§Example
use dts_core::{de::DeserializerBuilder, Encoding};
use serde_json::json;
let buf = r#"["foo"]"#.as_bytes();
let mut de = DeserializerBuilder::new().build(buf);
let value = de.deserialize(Encoding::Json)?;
assert_eq!(value, json!(["foo"]));Auto Trait Implementations§
impl<R> Freeze for Deserializer<R>where
R: Freeze,
impl<R> RefUnwindSafe for Deserializer<R>where
R: RefUnwindSafe,
impl<R> Send for Deserializer<R>where
R: Send,
impl<R> Sync for Deserializer<R>where
R: Sync,
impl<R> Unpin for Deserializer<R>where
R: Unpin,
impl<R> UnwindSafe for Deserializer<R>where
R: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more