wireform-proto-0.2.0.0: src/Proto/Google/Protobuf/Empty.hs
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-matches -Wno-unused-top-binds #-}
{- | Auto-generated protobuf types from package @google.protobuf@.
__THIS FILE IS AUTO-GENERATED BY wireform. DO NOT EDIT.__
Any manual changes will be overwritten the next time code
generation is run. To modify the types or instances, edit the
@.proto@ source file and re-run the code generator.
-}
module Proto.Google.Protobuf.Empty where
import Control.DeepSeq (NFData (..))
import Data.Aeson qualified as Aeson
import Data.Aeson.Key qualified as AesonKey
import Data.Aeson.KeyMap qualified as AesonKM
import Data.Aeson.Types qualified as Aeson
import Data.ByteString (ByteString)
import Data.ByteString qualified as BS
import Data.Hashable (Hashable (..))
import Data.Int (Int32, Int64)
import Data.Map.Strict qualified as Map
import Data.Proxy (Proxy (..))
import Data.Reflection (Given (..), given)
import Data.Text (Text)
import Data.Text qualified as T
import Data.Vector qualified as V
import Data.Vector.Unboxed qualified as VU
import Data.Word (Word32, Word64)
import GHC.Generics (Generic)
import Proto.Decode
import Proto.Encode
import Proto.Extension qualified
import Proto.Internal.Encode.Archetype (
archBool,
archBoolSize,
archBytes,
archBytesSize,
archDouble,
archFixed32,
archFixed32Size,
archFixed64,
archFixed64Size,
archFloat,
archSVarint32,
archSVarint64,
archString,
archStringSize,
archSubmessage,
archSubmessageSize,
archVarint,
archVarintSize,
)
import Proto.Internal.JSON (bytesFieldToJSON, bytesMapFieldToJSON, jsonObject, parseBytesFieldMaybe, parseBytesMapFieldMaybe, parseFieldMaybe, protoBytesToJSON, (.=:))
import Proto.Internal.JSON.Extension qualified as PJExt
import Proto.Internal.Wire (Tag (..), WireType (..))
import Proto.Internal.Wire.Encode (
fieldBoolSize,
fieldBytesSize,
fieldDoubleSize,
fieldFixed32Size,
fieldFixed64Size,
fieldFloatSize,
fieldMessageSize,
fieldSVarint32Size,
fieldSVarint64Size,
fieldTextSize,
fieldVarintSize,
putByteString,
putDouble,
putFixed32,
putFixed64,
putFloat,
putLengthDelimited,
putSVarint32,
putSVarint64,
putTag,
putText,
putVarint,
putVarintSigned,
tagSize,
varintSize,
varintSize32,
zigZag32,
zigZag64,
)
import Proto.Registry (IsMessage)
import Proto.Registry qualified
import Proto.Schema (FieldDescriptor (..), FieldLabel' (..), FieldTypeDescriptor (..), ProtoMessage (..), ScalarFieldType (..), SomeFieldDescriptor (..))
import Wireform.Builder qualified as B
{- | Serialized FileDescriptorProto for this .proto file.
Decode with @Proto.Google.Protobuf.Descriptor.decodeMessage@.
-}
fileDescriptorProtoBytes :: ByteString
fileDescriptorProtoBytes = "\x0a\x1b\x67\x6f\x6f\x67\x6c\x65\x2f\x70\x72\x6f\x74\x6f\x62\x75\x66\x2f\x65\x6d\x70\x74\x79\x2e\x70\x72\x6f\x74\x6f\x12\x0f\x67\x6f\x6f\x67\x6c\x65\x2e\x70\x72\x6f\x74\x6f\x62\x75\x66\x22\x07\x0a\x05\x45\x6d\x70\x74\x79\x62\x06\x70\x72\x6f\x74\x6f\x33"
data Empty = Empty
{ emptyUnknownFields :: ![UnknownField]
}
deriving stock (Show, Eq, Generic)
deriving anyclass (NFData)
defaultEmpty :: Empty
defaultEmpty =
Empty
{ emptyUnknownFields = []
}
instance MessageEncode Empty where
buildMessage msg =
encodeUnknownFields msg.emptyUnknownFields
instance MessageSize Empty where
messageSize msg =
unknownFieldsSize msg.emptyUnknownFields
instance MessageDecode Empty where
{-# INLINE messageDecoder #-}
messageDecoder = loop []
where
loop acc_unknown_ =
withTagM
(pure (Empty {emptyUnknownFields = reverse acc_unknown_}))
( \fn wt -> case fn of
_ -> do
uf <- captureUnknownField fn (toEnum wt)
loop (uf : acc_unknown_)
)
instance ProtoMessage Empty where
protoMessageName _ = "google.protobuf.Empty"
protoPackageName _ = "google.protobuf"
protoDefaultValue = defaultEmpty
protoFileDescriptorBytes _ = fileDescriptorProtoBytes
protoFieldDescriptors _ =
Map.fromList
[]
instance IsMessage Empty
instance Aeson.ToJSON Empty where
toJSON msg =
jsonObject
[]
instance Aeson.FromJSON Empty where
parseJSON _ = pure defaultEmpty
instance Hashable Empty where
hashWithSalt salt _ = salt
instance Proto.Extension.HasExtensions Empty where
messageUnknownFields = emptyUnknownFields
setMessageUnknownFields !ufs msg = msg {emptyUnknownFields = ufs}
instance Semigroup Empty where
a <> b =
Empty
{ emptyUnknownFields = a.emptyUnknownFields <> b.emptyUnknownFields
}
instance Monoid Empty where
mempty = defaultEmpty