Struct SerdeJsonCodec
pub struct SerdeJsonCodec { /* private fields */ }Available on crate features
io and codec-serde-json only.Expand description
A codec for JSON serialization and deserialization using serde_json.
This codec can be configured to output pretty-printed JSON by setting the
pretty flag.
Implementations§
§impl SerdeJsonCodec
impl SerdeJsonCodec
pub fn new() -> SerdeJsonCodec
pub fn new() -> SerdeJsonCodec
Creates a new SerdeJsonCodec with default settings (not
pretty-printed).
pub fn pretty() -> SerdeJsonCodec
pub fn pretty() -> SerdeJsonCodec
Creates a new SerdeJsonCodec with pretty-printing enabled.
pub fn set_pretty(&mut self, pretty: bool) -> &mut SerdeJsonCodec
pub fn set_pretty(&mut self, pretty: bool) -> &mut SerdeJsonCodec
Sets whether the JSON output should be pretty-printed.
Trait Implementations§
§impl Clone for SerdeJsonCodec
impl Clone for SerdeJsonCodec
§fn clone(&self) -> SerdeJsonCodec
fn clone(&self) -> SerdeJsonCodec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for SerdeJsonCodec
impl Debug for SerdeJsonCodec
§impl<T> Decoder<T> for SerdeJsonCodecwhere
T: DeserializeOwned,
impl<T> Decoder<T> for SerdeJsonCodecwhere
T: DeserializeOwned,
§type Error = SerdeJsonCodecError
type Error = SerdeJsonCodecError
Errors happened during the decoding process
§impl Default for SerdeJsonCodec
impl Default for SerdeJsonCodec
§fn default() -> SerdeJsonCodec
fn default() -> SerdeJsonCodec
Returns the “default value” for a type. Read more
§impl<T> Encoder<T> for SerdeJsonCodecwhere
T: Serialize,
impl<T> Encoder<T> for SerdeJsonCodecwhere
T: Serialize,
§impl Hash for SerdeJsonCodec
impl Hash for SerdeJsonCodec
§impl PartialEq for SerdeJsonCodec
impl PartialEq for SerdeJsonCodec
impl Copy for SerdeJsonCodec
impl Eq for SerdeJsonCodec
impl StructuralPartialEq for SerdeJsonCodec
Auto Trait Implementations§
impl Freeze for SerdeJsonCodec
impl RefUnwindSafe for SerdeJsonCodec
impl Send for SerdeJsonCodec
impl Sync for SerdeJsonCodec
impl Unpin for SerdeJsonCodec
impl UnwindSafe for SerdeJsonCodec
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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