pub struct SerdeAdapter<T: Serialize + DeserializeOwned>(pub T);
Expand description

A wrapper that allows serializing types that only implement CWs serialization traits. It simply uses CWs facilities to convert to JSON text bytes which Fadroma’s binary serialization understands.

By using this you are effectively bypassing Fadroma’s binary serialization benefits. As such, you probably don’t want to use it outside of testing…

Tuple Fields§

§0: T

Trait Implementations§

source§

impl<T: Clone + Serialize + DeserializeOwned> Clone for SerdeAdapter<T>

source§

fn clone(&self) -> SerdeAdapter<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + Serialize + DeserializeOwned> Debug for SerdeAdapter<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Serialize + DeserializeOwned> FadromaDeserialize for SerdeAdapter<T>

source§

fn from_bytes<'a>(de: &mut Deserializer<'a>) -> Result<Self>

Deserialize into a new instance by reading bytes from the provided Deserializer.
source§

impl<T: Serialize + DeserializeOwned> FadromaSerialize for SerdeAdapter<T>

source§

fn size_hint(&self) -> usize

The size in bytes of the particular instance when converted to its byte respresentation. While it’s preferred that this method returns an exact size (or at least a bigger estimation) it’s not an error to return an incorrect number. The penalty for doing so is potentially incurring unnecessary re-allocations.
source§

fn to_bytes(&self, ser: &mut Serializer) -> Result<()>

Serialize the instance into bytes by writing to the provided Serializer.
source§

impl<T: Serialize + DeserializeOwned> From<T> for SerdeAdapter<T>

source§

fn from(item: T) -> Self

Converts to this type from the input type.
source§

impl<T: PartialEq + Serialize + DeserializeOwned> PartialEq<SerdeAdapter<T>> for SerdeAdapter<T>

source§

fn eq(&self, other: &SerdeAdapter<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Serialize + DeserializeOwned> StructuralPartialEq for SerdeAdapter<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for SerdeAdapter<T>where T: RefUnwindSafe,

§

impl<T> Send for SerdeAdapter<T>where T: Send,

§

impl<T> Sync for SerdeAdapter<T>where T: Sync,

§

impl<T> Unpin for SerdeAdapter<T>where T: Unpin,

§

impl<T> UnwindSafe for SerdeAdapter<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> FadromaSerializeExt for Twhere T: FadromaSerialize,

source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V