#[repr(transparent)]pub struct NotCopy<T>(pub T);Expand description
This type exists for one purpose and one purpose only. To help you ensure you’re mutating
the correct thing, and not mutating a copy. Put Copy types in here to rob them of their Copy implementation.
This wrapper tries to be transparent in every way, of course it can’t implement every trait in existence,
but we’ll try to get the important ones. Crate feature “serde” will include Serialize and Deserialize.
Major omissions from the trait implementations include common math traits, because consuming a NotCopy
usually isn’t helpful, and those traits consume. However, traits such as AddAssign are implemented because
they’re just a mutation.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T, Rhs> AddAssign<Rhs> for NotCopy<T>where
T: AddAssign<Rhs>,
impl<T, Rhs> AddAssign<Rhs> for NotCopy<T>where
T: AddAssign<Rhs>,
Source§fn add_assign(&mut self, rhs: Rhs)
fn add_assign(&mut self, rhs: Rhs)
Performs the
+= operation. Read moreSource§impl<T, Rhs> BitAndAssign<Rhs> for NotCopy<T>where
T: BitAndAssign<Rhs>,
impl<T, Rhs> BitAndAssign<Rhs> for NotCopy<T>where
T: BitAndAssign<Rhs>,
Source§fn bitand_assign(&mut self, rhs: Rhs)
fn bitand_assign(&mut self, rhs: Rhs)
Performs the
&= operation. Read moreSource§impl<T, Rhs> BitOrAssign<Rhs> for NotCopy<T>where
T: BitOrAssign<Rhs>,
impl<T, Rhs> BitOrAssign<Rhs> for NotCopy<T>where
T: BitOrAssign<Rhs>,
Source§fn bitor_assign(&mut self, rhs: Rhs)
fn bitor_assign(&mut self, rhs: Rhs)
Performs the
|= operation. Read moreSource§impl<T, Rhs> BitXorAssign<Rhs> for NotCopy<T>where
T: BitXorAssign<Rhs>,
impl<T, Rhs> BitXorAssign<Rhs> for NotCopy<T>where
T: BitXorAssign<Rhs>,
Source§fn bitxor_assign(&mut self, rhs: Rhs)
fn bitxor_assign(&mut self, rhs: Rhs)
Performs the
^= operation. Read moreSource§impl<T, Rhs> DivAssign<Rhs> for NotCopy<T>where
T: DivAssign<Rhs>,
impl<T, Rhs> DivAssign<Rhs> for NotCopy<T>where
T: DivAssign<Rhs>,
Source§fn div_assign(&mut self, rhs: Rhs)
fn div_assign(&mut self, rhs: Rhs)
Performs the
/= operation. Read moreSource§impl<T, Rhs> MulAssign<Rhs> for NotCopy<T>where
T: MulAssign<Rhs>,
impl<T, Rhs> MulAssign<Rhs> for NotCopy<T>where
T: MulAssign<Rhs>,
Source§fn mul_assign(&mut self, rhs: Rhs)
fn mul_assign(&mut self, rhs: Rhs)
Performs the
*= operation. Read moreSource§impl<T: Ord> Ord for NotCopy<T>
impl<T: Ord> Ord for NotCopy<T>
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: PartialOrd> PartialOrd for NotCopy<T>
impl<T: PartialOrd> PartialOrd for NotCopy<T>
Source§impl<T, Rhs> RemAssign<Rhs> for NotCopy<T>where
T: RemAssign<Rhs>,
impl<T, Rhs> RemAssign<Rhs> for NotCopy<T>where
T: RemAssign<Rhs>,
Source§fn rem_assign(&mut self, rhs: Rhs)
fn rem_assign(&mut self, rhs: Rhs)
Performs the
%= operation. Read moreSource§impl<T, Rhs> ShlAssign<Rhs> for NotCopy<T>where
T: ShlAssign<Rhs>,
impl<T, Rhs> ShlAssign<Rhs> for NotCopy<T>where
T: ShlAssign<Rhs>,
Source§fn shl_assign(&mut self, rhs: Rhs)
fn shl_assign(&mut self, rhs: Rhs)
Performs the
<<= operation. Read moreSource§impl<T, Rhs> ShrAssign<Rhs> for NotCopy<T>where
T: ShrAssign<Rhs>,
impl<T, Rhs> ShrAssign<Rhs> for NotCopy<T>where
T: ShrAssign<Rhs>,
Source§fn shr_assign(&mut self, rhs: Rhs)
fn shr_assign(&mut self, rhs: Rhs)
Performs the
>>= operation. Read moreSource§impl<T, Rhs> SubAssign<Rhs> for NotCopy<T>where
T: SubAssign<Rhs>,
impl<T, Rhs> SubAssign<Rhs> for NotCopy<T>where
T: SubAssign<Rhs>,
Source§fn sub_assign(&mut self, rhs: Rhs)
fn sub_assign(&mut self, rhs: Rhs)
Performs the
-= operation. Read moreimpl<T: Eq> Eq for NotCopy<T>
impl<T> StructuralPartialEq for NotCopy<T>
Auto Trait Implementations§
impl<T> Freeze for NotCopy<T>where
T: Freeze,
impl<T> RefUnwindSafe for NotCopy<T>where
T: RefUnwindSafe,
impl<T> Send for NotCopy<T>where
T: Send,
impl<T> Sync for NotCopy<T>where
T: Sync,
impl<T> Unpin for NotCopy<T>where
T: Unpin,
impl<T> UnsafeUnpin for NotCopy<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NotCopy<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