]> git.proxmox.com Git - rustc.git/blame - library/std/src/sync/mpsc/cache_aligned.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / library / std / src / sync / mpsc / cache_aligned.rs
CommitLineData
532ac7d7 1use crate::ops::{Deref, DerefMut};
abe05a73
XL
2
3#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
923072b8
FG
4#[cfg_attr(target_arch = "aarch64", repr(align(128)))]
5#[cfg_attr(not(target_arch = "aarch64"), repr(align(64)))]
3c0e092e 6pub(super) struct CacheAligned<T>(pub T);
abe05a73
XL
7
8impl<T> Deref for CacheAligned<T> {
60c5eb7d
XL
9 type Target = T;
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
abe05a73
XL
13}
14
15impl<T> DerefMut for CacheAligned<T> {
60c5eb7d
XL
16 fn deref_mut(&mut self) -> &mut Self::Target {
17 &mut self.0
18 }
abe05a73
XL
19}
20
21impl<T> CacheAligned<T> {
22 pub(super) fn new(t: T) -> Self {
3c0e092e 23 CacheAligned(t)
abe05a73
XL
24 }
25}