Struct rustc_data_structures::tagged_ptr::copy::CopyTaggedPtr
source · [−]pub struct CopyTaggedPtr<P, T, const COMPARE_PACKED: bool> where
P: Pointer,
T: Tag, {
packed: NonZeroUsize,
data: PhantomData<(P, T)>,
}
Expand description
A Copy
TaggedPtr.
You should use this instead of the TaggedPtr
type in all cases where
P: Copy
.
If COMPARE_PACKED
is true, then the pointers will be compared and hashed without
unpacking. Otherwise we don’t implement PartialEq/Eq/Hash; if you want that,
wrap the TaggedPtr.
Fields
packed: NonZeroUsize
data: PhantomData<(P, T)>
Implementations
sourceimpl<P, T, const COMPARE_PACKED: bool> CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
impl<P, T, const COMPARE_PACKED: bool> CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
const TAG_BIT_SHIFT: usize = usize::BITS as usize - T::BITS
const ASSERTION: () = {
assert!(T::BITS <= P::BITS);
// Used for the transmute_copy's below
assert!(std::mem::size_of::<&P::Target>() == std::mem::size_of::());
}
pub fn new(pointer: P, tag: T) -> Self
pub(super) fn pointer_raw(&self) -> usize
pub fn pointer(self) -> P where
P: Copy,
pub fn pointer_ref(&self) -> &P::Target
pub fn pointer_mut(&mut self) -> &mut P::Target where
P: DerefMut,
pub fn tag(&self) -> T
pub fn set_tag(&mut self, tag: T)
Trait Implementations
sourceimpl<P, T, const COMPARE_PACKED: bool> Clone for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
P: Copy,
impl<P, T, const COMPARE_PACKED: bool> Clone for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
P: Copy,
sourceimpl<P, T, const COMPARE_PACKED: bool> Debug for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
P::Target: Debug,
T: Tag + Debug,
impl<P, T, const COMPARE_PACKED: bool> Debug for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
P::Target: Debug,
T: Tag + Debug,
sourceimpl<P, T, const COMPARE_PACKED: bool> Deref for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
impl<P, T, const COMPARE_PACKED: bool> Deref for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
sourceimpl<P, T, const COMPARE_PACKED: bool> DerefMut for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer + DerefMut,
T: Tag,
impl<P, T, const COMPARE_PACKED: bool> DerefMut for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer + DerefMut,
T: Tag,
sourceimpl<P, T> Hash for CopyTaggedPtr<P, T, true> where
P: Pointer,
T: Tag,
impl<P, T> Hash for CopyTaggedPtr<P, T, true> where
P: Pointer,
T: Tag,
sourceimpl<P, T, HCX, const COMPARE_PACKED: bool> HashStable<HCX> for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer + HashStable<HCX>,
T: Tag + HashStable<HCX>,
impl<P, T, HCX, const COMPARE_PACKED: bool> HashStable<HCX> for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer + HashStable<HCX>,
T: Tag + HashStable<HCX>,
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher)
sourceimpl<P, T> PartialEq<CopyTaggedPtr<P, T, true>> for CopyTaggedPtr<P, T, true> where
P: Pointer,
T: Tag,
impl<P, T> PartialEq<CopyTaggedPtr<P, T, true>> for CopyTaggedPtr<P, T, true> where
P: Pointer,
T: Tag,
impl<P, T, const COMPARE_PACKED: bool> Copy for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Pointer,
T: Tag,
P: Copy,
impl<P, T> Eq for CopyTaggedPtr<P, T, true> where
P: Pointer,
T: Tag,
Auto Trait Implementations
impl<P, T, const COMPARE_PACKED: bool> RefUnwindSafe for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T, const COMPARE_PACKED: bool> Send for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Send,
T: Send,
impl<P, T, const COMPARE_PACKED: bool> Sync for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Sync,
T: Sync,
impl<P, T, const COMPARE_PACKED: bool> Unpin for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: Unpin,
T: Unpin,
impl<P, T, const COMPARE_PACKED: bool> UnwindSafe for CopyTaggedPtr<P, T, COMPARE_PACKED> where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized,
impl<T> Erased for T
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes