Skip to main content

frame_alloc/strategies/
cpu_id.rs

1/// Strategy for mapping the *calling CPU* to a slot index.
2///
3/// Implement this trait to tell the allocator on which CPU he
4/// is on (the returned value is viewed a *hint*).
5pub trait CpuId {
6    /// A stable per-CPU index for the calling CPU.
7    fn current_cpu() -> usize;
8}
9
10/// Default implementation: routes everything to index 0.
11pub struct NoCpuId;
12
13impl CpuId for NoCpuId {
14    fn current_cpu() -> usize {
15        0
16    }
17}