Skip to content

Support custom binary backends

Original discussion: #12 (comment 358484110)

By having Binary.write: type backend. (module Backend with type t = backend) -> 'a encoding -> 'a -> backend we can allow encodings to be written directly to another type than the current bytes.

The module passed as argument includes primitives to write bytes, words, etc. These primitives are used by the write to emit the different binary chunks that the encoded value is represented by.

Example use: write directly to a Unix pipe to stream an encoded value, write to a cstruct or a bigarray to avoid having to blit bytes.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information