rattletrap-3.1.0: Parse and generate Rocket League replays.

Safe HaskellNone
LanguageHaskell2010

Rattletrap.Primitive.Section

Synopsis

Documentation

newtype Section a Source #

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.

Constructors

Section 

Fields

Instances

Eq a => Eq (Section a) Source # 

Methods

(==) :: Section a -> Section a -> Bool #

(/=) :: Section a -> Section a -> Bool #

Ord a => Ord (Section a) Source # 

Methods

compare :: Section a -> Section a -> Ordering #

(<) :: Section a -> Section a -> Bool #

(<=) :: Section a -> Section a -> Bool #

(>) :: Section a -> Section a -> Bool #

(>=) :: Section a -> Section a -> Bool #

max :: Section a -> Section a -> Section a #

min :: Section a -> Section a -> Section a #

Show a => Show (Section a) Source # 

Methods

showsPrec :: Int -> Section a -> ShowS #

show :: Section a -> String #

showList :: [Section a] -> ShowS #

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)