protobuf-builder-0.1.0.0: Slow protobuf implementation
Safe HaskellSafe-Inferred
LanguageHaskell2010

Protobuf.Builder

Description

Encode data with protobuf. Under the hood, this uses catenable byte sequences, meaning that a large number of small ByteArrays are allocated during encoding. That makes this a simple but low-performance solution. To prevent incorrect use, Builder is parameterized by Value. This distinguishes encodings of primitives from encodings of sequences of key-value pairs. The functions message and pair are used to move between these two domains.

Synopsis

Documentation

data Builder :: Value -> Type where Source #

A protobuf object builder. The data constructor is exposed, but it is unsafe to use it.

Note that Builder 'Pairs has Semigroup and Monoid instances. This is an important part of the interface.

Constructors

Builder :: !Int -> !Builder -> Builder v 

Instances

Instances details
v ~ 'Pairs => Monoid (Builder v) Source # 
Instance details

Defined in Protobuf.Builder

Methods

mempty :: Builder v #

mappend :: Builder v -> Builder v -> Builder v #

mconcat :: [Builder v] -> Builder v #

v ~ 'Pairs => Semigroup (Builder v) Source # 
Instance details

Defined in Protobuf.Builder

Methods

(<>) :: Builder v -> Builder v -> Builder v #

sconcat :: NonEmpty (Builder v) -> Builder v #

stimes :: Integral b => b -> Builder v -> Builder v #

data WireType Source #

Protobuf's four wire types.

data Value Source #

Either a primitive type (a wire type) or a collector of encoded key-value pairs.

Constructors

Primitive WireType 
Pairs 

Variable Length

Fixed Length 32

Fixed Length 64

Messages

pair Source #

Arguments

:: forall (ty :: WireType). HasWireTypeNumber ty 
=> Word32

key

-> Builder ('Primitive ty)

value

-> Builder 'Pairs 

Length-Delimited