pub struct Partition {
pub index: u32,
pub name: String,
pub native: bool,
pub fields: Vec<u8>,
}Expand description
One of the device’s storage partitions, from cmd::PARTITIONS.
The index in the reply is the object class code — ObjectClass::from_raw numbers
positions in this table, gaps included.
Fields§
§index: u32Position in the table, and therefore the class code.
name: StringThe device’s own name: Piano, Samp Lib, Program, Set List, …
native: boolWhether this is the (Native) view of a library. Native and user partitions
describe one pool — identical capacity fields — ordered differently.
fields: Vec<u8>The 29 trailing bytes, verbatim: four big-endian words and then 13 one-byte flags. Only the words this type exposes an accessor for are decoded; the rest are carried so a caller can look at them without another read.
Static configuration, not state — every value is unchanged by storing or deleting content.
Confirmed on hardware.
Implementations§
Source§impl Partition
impl Partition
Sourcepub fn decode_all(msg: &Message) -> Result<Vec<Self>>
pub fn decode_all(msg: &Message) -> Result<Vec<Self>>
Decode a cmd::PARTITIONS reply: [u8 count] then that many
[u32 name_len][name][29 bytes] records.
⚠️ The length prefix is a u32. Read as a u16 the first record still parses
and every one after it lands mid-field, which looks like corruption rather than a
framing mistake.
Sourcepub fn allocation_unit(&self) -> Result<AllocationUnit>
pub fn allocation_unit(&self) -> Result<AllocationUnit>
The partition’s allocation granularity, in net bytes — the payload one unit of
whatever Status counts here holds.
Library partitions report a storage block minus its own overhead; an Electro 5
reports 261632 (256 KiB − 512) for pianos and 131064 (128 KiB − 8) for
samples. Slot-addressed partitions report 1, which is what says their counters
are byte-granular.
⚠️ Net, not gross. Sizing a write off the enclosing power-of-two block instead differs only for a body within the overhead of an exact block boundary, but it differs by a whole block when it does.
Confirmed on hardware.