// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. use ops::{Deref, DerefMut}; #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(align(64))] pub(super) struct Aligner; #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] pub(super) struct CacheAligned(pub T, pub Aligner); impl Deref for CacheAligned { type Target = T; fn deref(&self) -> &Self::Target { &self.0 } } impl DerefMut for CacheAligned { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl CacheAligned { pub(super) fn new(t: T) -> Self { CacheAligned(t, Aligner) } }