glean-0.1.0.0: thrift/annotation/gen-hs2/Rust/Types.hs
-----------------------------------------------------------------
-- Autogenerated by Thrift
--
-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-- @generated
-----------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-unused-imports#-}
{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Rust.Types
(Name(Name, name_name), Copy(Copy), RequestContext(RequestContext),
Arc(Arc), Box(Box), Exhaustive(Exhaustive), Ord(Ord),
NewType(NewType), Type(Type, type_name),
Serde(Serde, serde_enabled), Mod(Mod, mod_name),
Adapter(Adapter, adapter_name), Derive(Derive, derive_derives),
ServiceExn(ServiceExn, serviceExn_anyhow_to_application_exn))
where
import qualified Control.DeepSeq as DeepSeq
import qualified Control.Monad as Monad
import qualified Control.Monad.ST.Trans as ST
import qualified Control.Monad.Trans.Class as Trans
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Types as Aeson
import qualified Data.Default as Default
import qualified Data.HashMap.Strict as HashMap
import qualified Data.Hashable as Hashable
import qualified Data.List as List
import qualified Data.Ord as Ord
import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text
import qualified Prelude as Prelude
import qualified Scope.Types as Scope
import qualified Thrift.Binary.Parser as Parser
import qualified Thrift.CodegenTypesOnly as Thrift
import Control.Applicative ((<|>), (*>), (<*))
import Data.Aeson ((.:), (.:?), (.=), (.!=))
import Data.Monoid ((<>))
import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
newtype Name = Name{name_name :: Text.Text}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Name where
toJSON (Name __field__name)
= Aeson.object ("name" .= __field__name : Prelude.mempty)
instance Thrift.ThriftStruct Name where
buildStruct _proxy (Name __field__name)
= Thrift.genStruct _proxy
(Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
(Thrift.genText _proxy __field__name)
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__name <- ST.newSTRef ""
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getStringType _proxy
->
do !_val <- Trans.lift
(Thrift.parseText
_proxy)
ST.writeSTRef __field__name
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
Prelude.pure (Name __val__name)
_idMap = HashMap.fromList [("name", 1)]
_parse 0)
instance DeepSeq.NFData Name where
rnf (Name __field__name)
= DeepSeq.rnf __field__name `Prelude.seq` ()
instance Default.Default Name where
def = Name ""
instance Hashable.Hashable Name where
hashWithSalt __salt (Name _name)
= Hashable.hashWithSalt __salt _name
data Copy = Copy{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Copy where
toJSON Copy = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct Copy where
buildStruct _proxy Copy = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (Copy)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData Copy where
rnf Copy = ()
instance Default.Default Copy where
def = Copy
instance Hashable.Hashable Copy where
hashWithSalt __salt Copy = __salt
data RequestContext = RequestContext{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON RequestContext where
toJSON RequestContext = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct RequestContext where
buildStruct _proxy RequestContext = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (RequestContext)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData RequestContext where
rnf RequestContext = ()
instance Default.Default RequestContext where
def = RequestContext
instance Hashable.Hashable RequestContext where
hashWithSalt __salt RequestContext = __salt
data Arc = Arc{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Arc where
toJSON Arc = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct Arc where
buildStruct _proxy Arc = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (Arc)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData Arc where
rnf Arc = ()
instance Default.Default Arc where
def = Arc
instance Hashable.Hashable Arc where
hashWithSalt __salt Arc = __salt
data Box = Box{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Box where
toJSON Box = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct Box where
buildStruct _proxy Box = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (Box)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData Box where
rnf Box = ()
instance Default.Default Box where
def = Box
instance Hashable.Hashable Box where
hashWithSalt __salt Box = __salt
data Exhaustive = Exhaustive{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Exhaustive where
toJSON Exhaustive = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct Exhaustive where
buildStruct _proxy Exhaustive = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (Exhaustive)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData Exhaustive where
rnf Exhaustive = ()
instance Default.Default Exhaustive where
def = Exhaustive
instance Hashable.Hashable Exhaustive where
hashWithSalt __salt Exhaustive = __salt
data Ord = Ord{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Ord where
toJSON Ord = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct Ord where
buildStruct _proxy Ord = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (Ord)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData Ord where
rnf Ord = ()
instance Default.Default Ord where
def = Ord
instance Hashable.Hashable Ord where
hashWithSalt __salt Ord = __salt
data NewType = NewType{}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON NewType where
toJSON NewType = Aeson.object Prelude.mempty
instance Thrift.ThriftStruct NewType where
buildStruct _proxy NewType = Thrift.genStruct _proxy []
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do Prelude.pure (NewType)
_idMap = HashMap.fromList []
_parse 0)
instance DeepSeq.NFData NewType where
rnf NewType = ()
instance Default.Default NewType where
def = NewType
instance Hashable.Hashable NewType where
hashWithSalt __salt NewType = __salt
newtype Type = Type{type_name :: Text.Text}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Type where
toJSON (Type __field__name)
= Aeson.object ("name" .= __field__name : Prelude.mempty)
instance Thrift.ThriftStruct Type where
buildStruct _proxy (Type __field__name)
= Thrift.genStruct _proxy
(Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
(Thrift.genText _proxy __field__name)
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__name <- ST.newSTRef ""
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getStringType _proxy
->
do !_val <- Trans.lift
(Thrift.parseText
_proxy)
ST.writeSTRef __field__name
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
Prelude.pure (Type __val__name)
_idMap = HashMap.fromList [("name", 1)]
_parse 0)
instance DeepSeq.NFData Type where
rnf (Type __field__name)
= DeepSeq.rnf __field__name `Prelude.seq` ()
instance Default.Default Type where
def = Type ""
instance Hashable.Hashable Type where
hashWithSalt __salt (Type _name)
= Hashable.hashWithSalt __salt _name
newtype Serde = Serde{serde_enabled :: Prelude.Bool}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Serde where
toJSON (Serde __field__enabled)
= Aeson.object ("enabled" .= __field__enabled : Prelude.mempty)
instance Thrift.ThriftStruct Serde where
buildStruct _proxy (Serde __field__enabled)
= Thrift.genStruct _proxy
(Thrift.genFieldBool _proxy "enabled" 1 0 __field__enabled : [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__enabled <- ST.newSTRef Prelude.True
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getBoolType _proxy
->
do !_val <- Trans.lift
(Thrift.parseBoolF
_proxy
_bool)
ST.writeSTRef
__field__enabled
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__enabled <- ST.readSTRef
__field__enabled
Prelude.pure (Serde __val__enabled)
_idMap = HashMap.fromList [("enabled", 1)]
_parse 0)
instance DeepSeq.NFData Serde where
rnf (Serde __field__enabled)
= DeepSeq.rnf __field__enabled `Prelude.seq` ()
instance Default.Default Serde where
def = Serde Prelude.True
instance Hashable.Hashable Serde where
hashWithSalt __salt (Serde _enabled)
= Hashable.hashWithSalt __salt _enabled
newtype Mod = Mod{mod_name :: Text.Text}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Mod where
toJSON (Mod __field__name)
= Aeson.object ("name" .= __field__name : Prelude.mempty)
instance Thrift.ThriftStruct Mod where
buildStruct _proxy (Mod __field__name)
= Thrift.genStruct _proxy
(Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
(Thrift.genText _proxy __field__name)
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__name <- ST.newSTRef ""
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getStringType _proxy
->
do !_val <- Trans.lift
(Thrift.parseText
_proxy)
ST.writeSTRef __field__name
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
Prelude.pure (Mod __val__name)
_idMap = HashMap.fromList [("name", 1)]
_parse 0)
instance DeepSeq.NFData Mod where
rnf (Mod __field__name)
= DeepSeq.rnf __field__name `Prelude.seq` ()
instance Default.Default Mod where
def = Mod ""
instance Hashable.Hashable Mod where
hashWithSalt __salt (Mod _name)
= Hashable.hashWithSalt __salt _name
newtype Adapter = Adapter{adapter_name :: Text.Text}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Adapter where
toJSON (Adapter __field__name)
= Aeson.object ("name" .= __field__name : Prelude.mempty)
instance Thrift.ThriftStruct Adapter where
buildStruct _proxy (Adapter __field__name)
= Thrift.genStruct _proxy
(Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
(Thrift.genText _proxy __field__name)
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__name <- ST.newSTRef ""
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getStringType _proxy
->
do !_val <- Trans.lift
(Thrift.parseText
_proxy)
ST.writeSTRef __field__name
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
Prelude.pure (Adapter __val__name)
_idMap = HashMap.fromList [("name", 1)]
_parse 0)
instance DeepSeq.NFData Adapter where
rnf (Adapter __field__name)
= DeepSeq.rnf __field__name `Prelude.seq` ()
instance Default.Default Adapter where
def = Adapter ""
instance Hashable.Hashable Adapter where
hashWithSalt __salt (Adapter _name)
= Hashable.hashWithSalt __salt _name
newtype Derive = Derive{derive_derives :: [Text.Text]}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON Derive where
toJSON (Derive __field__derives)
= Aeson.object ("derives" .= __field__derives : Prelude.mempty)
instance Thrift.ThriftStruct Derive where
buildStruct _proxy (Derive __field__derives)
= Thrift.genStruct _proxy
(Thrift.genField _proxy "derives" (Thrift.getListType _proxy) 1 0
(Thrift.genList _proxy (Thrift.getStringType _proxy)
(Thrift.genText _proxy)
__field__derives)
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__derives <- ST.newSTRef Default.def
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getListType _proxy
->
do !_val <- Trans.lift
(Prelude.snd <$>
Thrift.parseList
_proxy
(Thrift.parseText
_proxy))
ST.writeSTRef
__field__derives
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__derives <- ST.readSTRef
__field__derives
Prelude.pure (Derive __val__derives)
_idMap = HashMap.fromList [("derives", 1)]
_parse 0)
instance DeepSeq.NFData Derive where
rnf (Derive __field__derives)
= DeepSeq.rnf __field__derives `Prelude.seq` ()
instance Default.Default Derive where
def = Derive Default.def
instance Hashable.Hashable Derive where
hashWithSalt __salt (Derive _derives)
= Hashable.hashWithSalt __salt _derives
newtype ServiceExn = ServiceExn{serviceExn_anyhow_to_application_exn
:: Prelude.Bool}
deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
instance Aeson.ToJSON ServiceExn where
toJSON (ServiceExn __field__anyhow_to_application_exn)
= Aeson.object
("anyhow_to_application_exn" .= __field__anyhow_to_application_exn
: Prelude.mempty)
instance Thrift.ThriftStruct ServiceExn where
buildStruct _proxy (ServiceExn __field__anyhow_to_application_exn)
= Thrift.genStruct _proxy
(Thrift.genFieldBool _proxy "anyhow_to_application_exn" 1 0
__field__anyhow_to_application_exn
: [])
parseStruct _proxy
= ST.runSTT
(do Prelude.return ()
__field__anyhow_to_application_exn <- ST.newSTRef Prelude.False
let
_parse _lastId
= do _fieldBegin <- Trans.lift
(Thrift.parseFieldBegin _proxy _lastId _idMap)
case _fieldBegin of
Thrift.FieldBegin _type _id _bool -> do case _id of
1 | _type ==
Thrift.getBoolType _proxy
->
do !_val <- Trans.lift
(Thrift.parseBoolF
_proxy
_bool)
ST.writeSTRef
__field__anyhow_to_application_exn
_val
_ -> Trans.lift
(Thrift.parseSkip _proxy
_type
(Prelude.Just _bool))
_parse _id
Thrift.FieldEnd -> do !__val__anyhow_to_application_exn <- ST.readSTRef
__field__anyhow_to_application_exn
Prelude.pure
(ServiceExn __val__anyhow_to_application_exn)
_idMap = HashMap.fromList [("anyhow_to_application_exn", 1)]
_parse 0)
instance DeepSeq.NFData ServiceExn where
rnf (ServiceExn __field__anyhow_to_application_exn)
= DeepSeq.rnf __field__anyhow_to_application_exn `Prelude.seq` ()
instance Default.Default ServiceExn where
def = ServiceExn Prelude.False
instance Hashable.Hashable ServiceExn where
hashWithSalt __salt (ServiceExn _anyhow_to_application_exn)
= Hashable.hashWithSalt __salt _anyhow_to_application_exn