Struct o1_utils::serialization::SerdeAs
source · pub struct SerdeAs;
Expand description
You can use SerdeAs with serde_with in order to serialize and deserialize types that implement [CanonicalSerialize] and [CanonicalDeserialize],
or containers of types that implement these traits (Vec, arrays, etc.)
Simply add annotations like #[serde_as(as = "o1_utils::serialization::SerdeAs")]
See https://docs.rs/serde_with/1.10.0/serde_with/guide/serde_as/index.html#switching-from-serdes-with-to-serde_as
Trait Implementations§
source§impl<'de, T> DeserializeAs<'de, T> for SerdeAswhere
T: CanonicalDeserialize,
impl<'de, T> DeserializeAs<'de, T> for SerdeAswhere T: CanonicalDeserialize,
source§fn deserialize_as<D>(deserializer: D) -> Result<T, D::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(deserializer: D) -> Result<T, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer.
source§impl<T> SerializeAs<T> for SerdeAswhere
T: CanonicalSerialize,
impl<T> SerializeAs<T> for SerdeAswhere T: CanonicalSerialize,
source§fn serialize_as<S>(val: &T, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_as<S>(val: &T, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,
Serialize this value into the given Serde serializer.
Auto Trait Implementations§
impl RefUnwindSafe for SerdeAs
impl Send for SerdeAs
impl Sync for SerdeAs
impl Unpin for SerdeAs
impl UnwindSafe for SerdeAs
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