proto3-wire-1.2.0: A low-level implementation of the Protocol Buffers (version 3) wire format

Safe HaskellSafe
LanguageHaskell2010

Proto3.Wire.Class

Description

This module defines classes which are shared by the encoding and decoding modules.

Synopsis

Documentation

class ProtoEnum a where Source #

Similar to Enum, but allows gaps in the sequence of numeric codes, and uses Int32 in order to match the proto3 specification.

Absent gaps, you can use an automatic derivation of Bounded and Enum, then use the default implementations for all methods of this class. But if gaps are involved, then you must instantiate this class directly and supply the specific numeric codes desired for each constructor.

Minimal complete definition

Nothing

Methods

toProtoEnumMay :: Int32 -> Maybe a Source #

Default implementation: toEnumMay.

toProtoEnumMay :: (Bounded a, Enum a) => Int32 -> Maybe a Source #

Default implementation: toEnumMay.

fromProtoEnum :: a -> Int32 Source #

Default implementation: fromEnum.

fromProtoEnum :: Enum a => a -> Int32 Source #

Default implementation: fromEnum.