Skip to main content

max_serialized_bound

Function max_serialized_bound 

Source
pub const fn max_serialized_bound<M: Message>() -> Option<usize>
Expand description

Phase 392 W3a — the type’s own receive-buffer bound, or None when it has none.

The VALUE behind bound_fits’s predicate. A subscription that knows its type’s bound can be routed to a size class instead of forcing the GLOBAL buffer knob up: ZPICO_SUBSCRIBER_BUFFER_SIZE multiplies across MAX_SUBSCRIBERS x RING_DEPTH, so raising it from 1024 to 4096 for one 4 KiB topic costs 98,304 bytes, while the large class that topic belongs in is already reserved and empty.

Takes the larger of the two encodings, for the same reason bound_fits does: the peer picks the encoding at runtime, so sizing from XCDR1 alone is a trap.

None means “no bound EXISTS”, never “unknown” — phase 380 is explicit that a buffer must not be sized from a fallback. A caller routing by size class must treat None as “keep the default”, not as “assume small”.