Skip to main content

status_to_write

Function status_to_write 

Source
pub fn status_to_write(
    object: &AnySubgroupObject,
) -> Result<Option<u64>, CodecError>
Expand description

The status code to encode for object, or None when a payload follows instead. An empty payload always carries a status on the wire, so a missing one defaults to Normal.

Status 0 with a payload is not a contradiction and is not refused. Every draft from 07 to 20 assigns 0x0 to Normal, and every one of them encodes a payload-bearing object by leaving the status field off — the status is Normal precisely because bytes follow. Saying so explicitly asks for the same frame as leaving it out, so both answer None, and the byte written is identical either way.

Any other status with a payload is refused: those are the statuses whose wire form is a status code standing where the payload would be, so there is no frame that carries both.