Skip to main content

Status

Struct Status 

Source
pub struct Status {
    pub class: ObjectClass,
    pub count: u32,
    pub free: u32,
    pub used: u32,
    pub dirty: u32,
    pub spare: u32,
}
Expand description

What cmd::STATUS reports, for whichever ObjectClass the session opened.

The unit differs by class family. The slot-addressed classes (program, set list, live, settings) count bytes: a program costs 141 = 121 body + 16 name + 4 CRC, a set list 38 = 18 + 16 + 4. The library classes (piano, sample) count storage blocks of Partition::allocation_unit net payload bytes each — just under 256 KiB for pianos and 128 KiB for samples on an Electro 5.

⚠️ free + used is not the capacity. A delete moves its space into Self::dirty, not into free, so a report built from those two words shrinks every time something is deleted. Self::total sums all four storage words, which is constant, and Self::available is the space a write can actually reach — free now, plus whatever the cleaning pass can reclaim out of dirty.

dirty and spare read 0 outside the library partitions.

Confirmed on hardware.

Fields§

§class: ObjectClass§count: u32§free: u32

Space a write may use immediately, without a cleaning pass.

§used: u32

Space live objects occupy. Deleting lowers this and raises dirty.

§dirty: u32

Space held by deleted objects, reclaimable by cmd::WRITE_PREPARE. Survives a power cycle, where free’s prepared state does not reliably.

§spare: u32

The fifth word: a small per-partition constant (1 and 2 observed), never seen to move. Meaning unknown, and counted in Self::total only because the four storage words together sum to a value that does not change.

Implementations§

Source§

impl Status

Source

pub fn total(&self) -> u64

The partition’s capacity — constant per class, in the class’s own unit.

Source

pub fn available(&self) -> u64

Space a write can reach: what is free now plus what cleaning can reclaim.

A partition reporting free 0 with a large dirty pool is entirely writable — crate::op::write reclaims the shortfall before it begins.

Source

pub fn bytes_per_item(&self) -> Option<u32>

Bytes per item, when every item of this class costs the same.

Only the slot-addressed classes resolve: their STATUS unit is bytes and every item is one fixed record. The library classes count blocks of genuinely variable-size content, and a class this crate cannot name has no known unit, so both yield None whatever their counters happen to divide into.

Source

pub fn slots(&self) -> Option<u32>

Total item slots, for classes where items are fixed-size.

Far more meaningful than a byte count: programs report 400, which is exactly the 8 banks × 50 slots of an Electro 5.

Source

pub fn used_percent(&self) -> f32

Source

pub fn decode(class: ObjectClass, msg: &Message) -> Result<Self>

Decode a cmd::STATUS response: count, free, used, dirty, spare.

The five-word shape is what an Electro 5 answers. Confirmed on hardware. Only the first three words are required; a shorter reply decodes with the missing words as zero.

Trait Implementations§

Source§

impl Clone for Status

Source§

fn clone(&self) -> Status

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Status

Source§

impl Debug for Status

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Status

Source§

impl PartialEq for Status

Source§

fn eq(&self, other: &Status) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.