pub struct BorrowCompat<T>(pub T);Expand description
Wrapper struct that implements BorrowDecode and Encode on any type that implements serde’s Deserialize and Serialize respectively. This is mostly used on &[u8] and &str, for other types consider using Compat instead.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<'de, T, Context> BorrowDecode<'de, Context> for BorrowCompat<T>where
T: Deserialize<'de>,
impl<'de, T, Context> BorrowDecode<'de, Context> for BorrowCompat<T>where
T: Deserialize<'de>,
Source§fn borrow_decode<D: BorrowDecoder<'de>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<T: Clone> Clone for BorrowCompat<T>
impl<T: Clone> Clone for BorrowCompat<T>
Source§fn clone(&self) -> BorrowCompat<T>
fn clone(&self) -> BorrowCompat<T>
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 moreSource§impl<T> Debug for BorrowCompat<T>where
T: Debug,
impl<T> Debug for BorrowCompat<T>where
T: Debug,
Source§impl<T: Default> Default for BorrowCompat<T>
impl<T: Default> Default for BorrowCompat<T>
Source§fn default() -> BorrowCompat<T>
fn default() -> BorrowCompat<T>
Returns the “default value” for a type. Read more
Source§impl<T> Display for BorrowCompat<T>where
T: Display,
impl<T> Display for BorrowCompat<T>where
T: Display,
Source§impl<T> Encode for BorrowCompat<T>where
T: Serialize,
impl<T> Encode for BorrowCompat<T>where
T: Serialize,
Source§impl<T: Hash> Hash for BorrowCompat<T>
impl<T: Hash> Hash for BorrowCompat<T>
Source§impl<T: Ord> Ord for BorrowCompat<T>
impl<T: Ord> Ord for BorrowCompat<T>
Source§fn cmp(&self, other: &BorrowCompat<T>) -> Ordering
fn cmp(&self, other: &BorrowCompat<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> PartialEq for BorrowCompat<T>
impl<T: PartialEq> PartialEq for BorrowCompat<T>
Source§impl<T: PartialOrd> PartialOrd for BorrowCompat<T>
impl<T: PartialOrd> PartialOrd for BorrowCompat<T>
impl<T: Eq> Eq for BorrowCompat<T>
impl<T> StructuralPartialEq for BorrowCompat<T>
Auto Trait Implementations§
impl<T> Freeze for BorrowCompat<T>where
T: Freeze,
impl<T> RefUnwindSafe for BorrowCompat<T>where
T: RefUnwindSafe,
impl<T> Send for BorrowCompat<T>where
T: Send,
impl<T> Sync for BorrowCompat<T>where
T: Sync,
impl<T> Unpin for BorrowCompat<T>where
T: Unpin,
impl<T> UnwindSafe for BorrowCompat<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