Skip to main content

is_loan_eligible

Function is_loan_eligible 

Source
pub const fn is_loan_eligible<M: Message>() -> bool
Expand description

Phase 380 W5 — is this type loan-eligible?

A loan hands out a pointer into the transport’s own memory, which is sound only when the layout is fixed: no length prefix to chase, no variable member. That is exactly SizeBound::plain, so the answer falls out of W1 rather than becoming a second notion of “fixed layout” maintained by hand — which is the drift borrow_loaned_message and subscription_supports_in_place would otherwise each grow their own version of.

It has no non-test caller, and that is the decision rather than an oversight (issue 1422; the same finding as issue 1369). Its natural consumer is a TYPED loan, and issue 0814 recommends not building one now: the byte-span loan surface it would sit beside is measured as strictly worse than publish_raw on three of four backends, and the one place IS_PLAIN matches a real gate is Cyclone’s own fixed_size check, which loans only under iceoryx. 0814 step 5 is the consumer, if and when it exists. The function is kept — not inlined into that future caller — because its whole job is to be the one place the predicate is spelled; two spellings is the defect issue 1422 deleted from the codegen IR.