#memory-region #region #processor #format #hardware-aware #linux #list #part #parser #emit

cpulist

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

10 releases

Uses new Rust 2024

new 0.2.1 Jun 13, 2025
0.2.0 Apr 11, 2025
0.1.2 Apr 6, 2025
0.1.1 Mar 31, 2025
0.0.2 Mar 26, 2025

#1023 in Parser implementations

Download history 140/week @ 2025-03-02 259/week @ 2025-03-09 115/week @ 2025-03-16 278/week @ 2025-03-23 182/week @ 2025-03-30 258/week @ 2025-04-06 63/week @ 2025-04-13 33/week @ 2025-04-20 16/week @ 2025-04-27 18/week @ 2025-05-04 16/week @ 2025-05-11 11/week @ 2025-05-18 1/week @ 2025-06-01 127/week @ 2025-06-08

139 downloads per month
Used in 6 crates (2 directly)

MIT license

28KB
242 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-9,32-35,40

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.

Example

Basic conversion from/to strings:

The stride operator is also supported for parsing:


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.

Dependencies

~4–12MB
~156K SLoC