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. 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 this “wires to
borrow_loaned_message / subscription_supports_in_place”. It does not:
the definition shipped and the wiring was left to whoever owns those
slots, and the wiring waits — deliberately, since the loan surface
measures 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 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).