capnp-0.2.0.0: Cap'n Proto for Haskell

Safe HaskellNone
LanguageHaskell2010

Data.Capnp.GenHelpers

Description

This module provides various helpers used by generated code; developers are not expected to invoke them directly.

These helpers are used by the low-level api. Data.Capnp.GenHelpers.Pure defines helpers used by high-level api.

Synopsis

Documentation

getWordField :: (ReadCtx m msg, IsWord a) => Struct msg -> Int -> Int -> Word64 -> m a Source #

getWordField struct index offset def fetches a field from the struct's data section. index is the index of the 64-bit word in the data section in which the field resides. offset is the offset in bits from the start of that word to the field. def is the default value for this field.

setWordField :: (RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) => Struct (MutMsg s) -> a -> Int -> Int -> a -> m () Source #

setWordField struct value index offset def sets a field in the struct's data section. The meaning of the parameters are as in getWordField, with value being the value to set. The width of the value is inferred from its type.