1use crate::as_impl::impl_as;
2use crate::traits::{IntoOwned, ToBorrowed, ToOwned};
3use core::borrow::{Borrow, BorrowMut};
4use core::cmp::Ordering;
5use core::fmt::{Debug, Display, Formatter};
6use core::hash::{Hash, Hasher};
7use core::ops::{Deref, DerefMut};
8
9#[repr(transparent)]
27pub struct AsCopy<T: Copy>(pub T);
28
29impl<T: Copy> ToBorrowed<'_> for AsCopy<T> {
30 #[inline(always)]
31 fn to_borrowed(&self) -> Self {
32 AsCopy(self.0)
33 }
34}
35
36impl<T: Copy> ToOwned for AsCopy<T> {
37 type Owned = AsCopy<T>;
38
39 #[inline(always)]
40 fn to_owned(&self) -> Self::Owned {
41 AsCopy(self.0)
42 }
43}
44
45impl<T: Copy> IntoOwned for AsCopy<T> {
46 type Owned = AsCopy<T>;
47
48 #[inline(always)]
49 fn into_owned(self) -> Self::Owned {
50 AsCopy(self.0)
51 }
52}
53
54impl_as!(AsCopy, Copy);