produce

Function produce 

Source
pub fn produce<'b>(
    reply: &[u8],
    dispatch: &Dispatch<'_>,
    buf: &'b mut [u8],
) -> Produced<'b>
Expand description

Cut a whole reply down to the fragment one exchange carries.

reply is what the local dispatch produced, which for a continuable read may be larger than a payload holds. The result is the frame’s leading bytes followed by the slice of its trailing content beginning at dispatch.resume, sized to dispatch.budget and to buf.

A reply the caller cannot cut — one with no trailing content — is copied through whole. If it does not fit, that is not this function’s to hide: DeviceEngine::complete refuses it.