OxL Reference

9.6 Zero-copy views

  • decode_view<T>(buf: &bytes) -> view T | DecodeError validates the structure of the buffer and returns a view that reads fields lazily without copying.
  • view T is a borrow (§7.2): it lives no longer than the buffer. v.own() -> T creates an ordinary value.
  • In rpc handlers a parameter of type view T receives a view over the request buffer.

Implementation-defined. Laziness of view T and the limits of validation (D-8051; DIV-046; D-6501..D-6505). The Standard requires that a view T does not outlive the buffer; lazy reading is an optimisation. This implementation: only the OxL binary format and direct fields are supported; validation on creating a view decodes the value in full; an escape of a view out of its block through a variable of an outer block is not detected.

Source: docs/spec/oxl-standard.en.md