capnp-0.12.0.0: Cap'n Proto for Haskell
Safe HaskellNone
LanguageHaskell2010

Capnp.Canonicalize

Description

Capnproto message canonicalization, per:

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

Synopsis

Documentation

canonicalize :: (RWCtx m s, MonadReadMessage mutIn m) => Struct mutIn -> 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.