packages feed

protobuf-simple-0.1.0.0: test/Types/BytesOptMsg.hs

-- Generated by protobuf-simple. DO NOT EDIT!
module Types.BytesOptMsg where

import Control.Applicative ((<$>))
import Prelude ()
import qualified Data.ProtoBufInt as PB

newtype BytesOptMsg = BytesOptMsg
  { value :: PB.Maybe PB.ByteString
  } deriving (PB.Show, PB.Eq, PB.Ord)

instance PB.Default BytesOptMsg where
  defaultVal = BytesOptMsg
    { value = PB.defaultVal
    }

instance PB.Mergeable BytesOptMsg where
  merge a b = BytesOptMsg
    { value = PB.merge (value a) (value b)
    }

instance PB.Required BytesOptMsg where
  reqTags _ = PB.fromList []

instance PB.WireMessage BytesOptMsg where
  fieldToValue (PB.WireTag 1 PB.LenDelim) self = (\v -> self{value = PB.merge (value self) v}) <$> PB.getBytesOpt
  fieldToValue tag self = PB.getUnknown tag self

  messageToFields self = do
    PB.putBytesOpt (PB.WireTag 1 PB.LenDelim) (value self)