capnp-0.17.0.0: Cap'n Proto for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Capnp.Canonicalize

Description

Capnproto message canonicalization, per:

https://capnproto.org/encoding.html#canonicalization

Synopsis

Documentation

canonicalize :: RWCtx m s => Struct 'Const -> m (Message ('Mut s), Segment ('Mut s)) Source #

Return a canonicalized message with a copy of the given struct as its root. returns a (message, segment) pair, where the segment is the first and only segment of the returned message.

In addition to the usual reasons for failure when reading a message (traversal limit, malformed messages), this can fail if the message does not fit in a single segment, as the canonical form requires single-segment messages.

canonicalizeMut :: RWCtx m s => Struct ('Mut s) -> m (Message ('Mut s), Segment ('Mut s)) Source #