Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Section a = Section {
- sectionBody :: a
- getSection :: Get a -> Get (Section a)
- putSection :: (a -> Put) -> Section a -> Put
- crcMessage :: Word32 -> Word32 -> String
Documentation
A section is a large piece of a Replay
. It has a
32-bit size (in bytes), a 32-bit CRC (see Rattletrap.Crc), and then a
bunch of data (the body). This interface is provided so that you don't have
to think about the size and CRC.
Section | |
|
getSection :: Get a -> Get (Section a) Source #
Given a way to get the sectionBody
, gets a section. This will fail if
the section's CRC does not match.
let header =runGet
(getSection
getHeader
) bytes
putSection :: (a -> Put) -> Section a -> Put Source #
Given a way to put the sectionBody
, puts a section. This will also put
the size and CRC.
let bytes =runPut
(putSection
putContent
content)