pub struct PerCore<T> { /* private fields */ }Expand description
Heap-backed per-core storage (Vec, runtime slot count). See the module docs
for the slot/local split; StaticPerCore is the inline no-alloc tier.
Implementations§
Source§impl<T> PerCore<T>
impl<T> PerCore<T>
pub fn new_with(count: usize, factory: impl FnMut(usize) -> T) -> Self
pub fn from_vec(slots: Vec<T>) -> Self
Sourcepub fn local(&self) -> &T
pub fn local(&self) -> &T
The calling thread’s slot (std only). Threads spread round-robin; when
emitters outnumber slots, several share one — safe for a multi-producer
structure like crate::ring::Ring, just more contended.
pub fn slot(&self, index: usize) -> &T
pub fn count(&self) -> usize
Auto Trait Implementations§
impl<T> Freeze for PerCore<T>
impl<T> RefUnwindSafe for PerCore<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for PerCore<T>
impl<T> Sync for PerCore<T>
impl<T> Unpin for PerCore<T>
impl<T> UnsafeUnpin for PerCore<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for PerCore<T>where
Vec<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