Skip to main content

decode_request

Function decode_request 

Source
pub fn decode_request(input: &[u8]) -> Result<CodeGeneratorRequest, String>
Expand description

Decode a CodeGeneratorRequest from a protoc plugin’s stdin.

The element-memory bound is taken from the element_memory_limit plugin option if the request carries one, else ELEMENT_MEMORY_LIMIT_ENV, else TOOLING_ELEMENT_MEMORY_LIMIT. The option is read by scanning for it (peek_request_parameter) rather than from the decoded request, since it governs that decode.

Both plugins compose exactly this, so it lives here: a hint improved in one binary should never disagree with the other.

§Errors

Returns a message describing the failure, naming the ways to raise the bound when that is what rejected the request.