#memory-region #mechanism #format #processor #parser #linux #list

cpulist

Parse and emit the Linux 'cpulist' data format used to list processors, memory regions and similar entities

2 releases

new 0.0.1-pre.2 Mar 8, 2025

#695 in Rust patterns

36 downloads per month
Used in 4 crates (2 directly)

MIT license

12KB
199 lines

Utilities for parsing and emitting strings in the the cpulist format often used by Linux utilities that work with processor IDs, memory region IDs and similar numeric hardware identifiers.

Example cpulist string: 0,1,2-4,5-9:2,6-10:2

More details in the crate documentation.

This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.


lib.rs:

Utilities for parsing and emitting strings in the the cpulist format often used by Linux utilities that work with processor IDs, memory region IDs and similar numeric hardware identifiers.

Example cpulist string: 0,1,2-4,5-9:2,6-10:2

This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.

Format

The value is a comma-separated list of zero or more integers or integer ranges, where each item is either:

  • a single integer (e.g. 1)
  • a range of integers (e.g. 2-4)
  • a range of integers with a stride (step size) operator (e.g. 5-9:2 which is equivalent to 5,7,9)

Whitespace or extra characters are not allowed anywhere in the string.

The identifiers in the list are of size u32.

Dependencies

~0.7–1.1MB
~24K SLoC