Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Text msg
- newtype Data msg = Data (ListOf msg Word8)
- class ListElem msg e where
- data List msg e
- class ListElem (MutMsg s) e => MutListElem s e where
- getData :: ReadCtx m msg => ListOf msg Word8 -> m (Data msg)
- getText :: ReadCtx m msg => ListOf msg Word8 -> m (Text msg)
- newData :: WriteCtx m s => MutMsg s -> Int -> m (Data (MutMsg s))
- newText :: WriteCtx m s => MutMsg s -> Int -> m (Text (MutMsg s))
- dataBytes :: ReadCtx m msg => Data msg -> m ByteString
- textBuffer :: ReadCtx m msg => Text msg -> m (ListOf msg Word8)
- textBytes :: ReadCtx m msg => Text msg -> m ByteString
Documentation
A textual string (Text
in capnproto's schema language). On the wire,
this is NUL-terminated. The encoding should be UTF-8, but the library
does not verify this; users of the library must do validation themselves, if
they care about this.
Rationale: validation would require doing an up-front pass over the data, which runs counter to the overall design of capnproto.
A blob of bytes (Data
in capnproto's schema language). The argument
to the data constructor is a slice into the message, containing the raw
bytes.
class ListElem msg e where Source #
Types which may be stored as an element of a capnproto list.
length :: List msg e -> Int Source #
Get the length of a list.
index :: ReadCtx m msg => Int -> List msg e -> m e Source #
gets the index
i listi
th element of a list.
Instances
class ListElem (MutMsg s) e => MutListElem s e where Source #
Types which may be stored as an element of a *mutable* capnproto list.
setIndex :: RWCtx m s => e -> Int -> List (MutMsg s) e -> m () Source #
sets the setIndex
value i listi
th index in list
to @value
newList :: WriteCtx m s => MutMsg s -> Int -> m (List (MutMsg s) e) Source #
allocates and returns a new list of length
newList
msg sizesize
inside msg
.
Instances
newData :: WriteCtx m s => MutMsg s -> Int -> m (Data (MutMsg s)) Source #
Allocates a new data blob of length newData
msg lenlen
bytes
inside the message.
dataBytes :: ReadCtx m msg => Data msg -> m ByteString Source #
Convert a Data
to a ByteString
.
textBuffer :: ReadCtx m msg => Text msg -> m (ListOf msg Word8) Source #
Return the underlying buffer containing the text. This does not include the null terminator.
textBytes :: ReadCtx m msg => Text msg -> m ByteString Source #
Convert a Text
to a ByteString
, comprising the raw bytes of the text
(not counting the NUL terminator).