pub struct SerdeWrapper<T: Serialize + DeserializeOwned + 'static>(pub T);Expand description
A wrapper struct that allows bridging between SurrealValue and types that implement Serialize and Deserialize
§A note on parity with SurrealValue
Serializing and Deserializing a type does not behave the same as SurrealValue in some cases.
Notably:
- Enum variants behave differently
- The only primitives taken advantage of are String, Number, Bool, Bytes, Object, and Array
As such, it’s best to use SurrealValue directly where possible. This is intended for types where an implementation of SurrealValue isn’t available or practical
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Serialize + DeserializeOwned + 'static> SurrealValue for SerdeWrapper<T>
impl<T: Serialize + DeserializeOwned + 'static> SurrealValue for SerdeWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for SerdeWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for SerdeWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for SerdeWrapper<T>where
T: Send,
impl<T> Sync for SerdeWrapper<T>where
T: Sync,
impl<T> Unpin for SerdeWrapper<T>where
T: Unpin,
impl<T> UnsafeUnpin for SerdeWrapper<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SerdeWrapper<T>where
T: 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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