pub struct CpuSet(/* private fields */);
Expand description
A [libc::cpu_set_t
] sized appropriately to the number of processors on
this machine.
This is needed to support more than 1024 processors, since the statically
sized cpu_set_t
only has room for that many processors.
Implementations§
source§impl CpuSet
impl CpuSet
sourcepub fn buffer_len(&self) -> usize
pub fn buffer_len(&self) -> usize
Gets the length of the buffer in bytes, for use with syscalls.
sourcepub fn as_mut_ptr(&mut self) -> *mut cpu_set_t
pub fn as_mut_ptr(&mut self) -> *mut cpu_set_t
Gets a mutable pointer for use with syscalls.
sourcepub fn set(&mut self, index: u32) -> &mut Self
pub fn set(&mut self, index: u32) -> &mut Self
Sets processor index
in the CPU set.
Panics if index
is greater than or equal to max_procs
.
sourcepub fn set_mask_hex_string(
&mut self,
string_mask: &[u8],
) -> Result<(), InvalidHexString>
pub fn set_mask_hex_string( &mut self, string_mask: &[u8], ) -> Result<(), InvalidHexString>
Sets all the CPUs in the linear bitmask mask
, which is an ASCII
hexadecimal string.
This is useful for parsing the output of /sys/devices/system/cpu/topology
.
sourcepub fn set_mask_list(&mut self, list: &str) -> Result<(), InvalidCpuList>
pub fn set_mask_list(&mut self, list: &str) -> Result<(), InvalidCpuList>
Sets all the CPUs in the list list
, which is a comma-separated list of
ranges and single CPUs.
This is useful for parsing the output of /sys/devices/system/cpu/online
.
Trait Implementations§
impl Eq for CpuSet
impl StructuralPartialEq for CpuSet
Auto Trait Implementations§
impl Freeze for CpuSet
impl RefUnwindSafe for CpuSet
impl Send for CpuSet
impl Sync for CpuSet
impl Unpin for CpuSet
impl UnwindSafe for CpuSet
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)