pub struct SizeBound {
pub bytes: usize,
pub bounded: bool,
pub plain: bool,
}Expand description
What one walk of a schema can say about size.
Fields§
§bytes: usizeBytes, given the starting offset the walk was handed.
bounded: boolFalse once an unbounded String / WString / Sequence is reached —
bytes is then a FLOOR, not a bound, and callers must not size a buffer
from it.
plain: boolNo variable-length member anywhere, so the WIRE length is fixed: bytes
is EXACT rather than an upper bound.
Nothing dispatches on this, by decision (issues 1369 and 1422). It is
the walk’s exactness property, asserted as such by
plain_struct_bound_is_exact here and by
bound_holds_against_the_writer_for_every_generated_type over the whole
generated corpus, and it is surfaced as
crate::schema::Message::IS_PLAIN / is_loan_eligible so there is
ONE definition of “fixed layout” for whoever finally needs one.
The earlier text here said phase-380 W5 “wires this to
borrow_loaned_message / subscription_supports_in_place”. It does not:
W5 shipped the definition and left the wiring to whoever owns those slots
(docs/roadmap/archived/phase-380-serialized-size-bound.md:228-232), and
issue 0814 step 5 is where the wiring now waits — deliberately, since
0814 measures the loan surface as a cost on three of four backends and
the natural consumer of this predicate is Cyclone-with-iceoryx, which no
target we ship can reach. Do not gate the in-place path on it: that path
hands the callback raw CDR to deserialize, which needs no fixed layout, so
the flag would only take it away from every type with a String.
It is NOT “POD-blit eligible”, and a second flag under that name in the
codegen IR was deleted by issue 1422 for disagreeing with this one on
bool, on nested all-float64 structs and on mixed alignment. Nor does
it make the bound version-INDEPENDENT: XCDR2’s DHEADER is fixed-width, so
a plain type stays plain while its bound still differs per encoding
(Time measures 12 under XCDR1 and 16 under XCDR2).