pub struct Serialized<T>(pub T);
Expand description
Use it to pass T: Serialize
as JSON to a prepared statement.
ⓘ
#[derive(Serialize)]
struct SerializableStruct {
// ...
}
conn.prep_exec("INSERT INTO table (json_column) VALUES (?)",
(Serialized(SerializableStruct),));
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T> Clone for Serialized<T>where
T: Clone,
impl<T> Clone for Serialized<T>where
T: Clone,
Source§fn clone(&self) -> Serialized<T>
fn clone(&self) -> Serialized<T>
Returns a copy 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 moreSource§impl<T> Debug for Serialized<T>where
T: Debug,
impl<T> Debug for Serialized<T>where
T: Debug,
Source§impl<T> From<Serialized<T>> for Valuewhere
T: Serialize,
impl<T> From<Serialized<T>> for Valuewhere
T: Serialize,
Source§fn from(x: Serialized<T>) -> Value
fn from(x: Serialized<T>) -> Value
Converts to this type from the input type.
Source§impl<T> Hash for Serialized<T>where
T: Hash,
impl<T> Hash for Serialized<T>where
T: Hash,
Source§impl<T> Ord for Serialized<T>where
T: Ord,
impl<T> Ord for Serialized<T>where
T: Ord,
Source§fn cmp(&self, other: &Serialized<T>) -> Ordering
fn cmp(&self, other: &Serialized<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for Serialized<T>where
T: PartialEq,
impl<T> PartialEq for Serialized<T>where
T: PartialEq,
Source§impl<T> PartialOrd for Serialized<T>where
T: PartialOrd,
impl<T> PartialOrd for Serialized<T>where
T: PartialOrd,
Source§impl<T> Serialize for Serialized<T>where
T: Serialize,
impl<T> Serialize for Serialized<T>where
T: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Serialized<T>where
T: Copy,
impl<T> Eq for Serialized<T>where
T: Eq,
impl<T> StructuralPartialEq for Serialized<T>
Auto Trait Implementations§
impl<T> Freeze for Serialized<T>where
T: Freeze,
impl<T> RefUnwindSafe for Serialized<T>where
T: RefUnwindSafe,
impl<T> Send for Serialized<T>where
T: Send,
impl<T> Sync for Serialized<T>where
T: Sync,
impl<T> Unpin for Serialized<T>where
T: Unpin,
impl<T> UnwindSafe for Serialized<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.