-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | data serialization/deserialization conduit library
--   
--   The binary-conduit package. Allow binary serialization using iterative
--   conduit interface.
@package binary-conduit
@version 1.2.4.1

module Data.Conduit.Serialization.Binary

-- | Runs default <a>Decoder</a> repeatedly on a input stream.
conduitDecode :: (Binary b, MonadThrow m) => Conduit ByteString m b

-- | Runs default encoder on a input stream.
--   
--   This function produces a stream of bytes where for each input value
--   you will have a number of <a>ByteString</a>s, and no boundary between
--   different values.
conduitEncode :: (Binary b, MonadThrow m) => Conduit b m ByteString

-- | Runs default encoder on input stream.
--   
--   This function produces a ByteString per each incomming packet, it may
--   be useful in datagram based protocols. Function maintains following
--   property
--   
--   <pre>
--   'conduitMsgEncode' xs == 'CL.map' 'Data.ByteString.encode' =$= 'CL.map' 'LBS.toStrict'
--   </pre>
--   
--   This invariant is maintaind by the cost of additional data copy, so if
--   you packets can be serialized to the large data chunks or you
--   interested in iterative packet serialization concider using
--   <a>conduitPutList</a> or <a>conduitPutMany</a>
conduitMsgEncode :: (Binary b, MonadThrow m) => Conduit b m ByteString

-- | Runs getter repeatedly on a input stream.
conduitGet :: MonadThrow m => Get b -> Conduit ByteString m b

-- | Runs putter repeatedly on a input stream, returns an output stream.
conduitPut :: MonadThrow m => Conduit Put m ByteString

-- | Vectorized variant of <a>conduitPut</a> returning list contains all
--   chunks from one element representation
conduitPutList :: MonadThrow m => Conduit Put m [ByteString]

-- | Runs putter repeatedly on a input stream. Returns a lazy butestring so
--   it's possible to use vectorized IO on the result either by calling'
--   LBS.toChunks' or by calling <a>send</a>.
conduitPutLBS :: MonadThrow m => Conduit Put m ByteString

-- | Vectorized variant of <a>conduitPut</a>.
conduitPutMany :: MonadThrow m => Conduit Put m (Vector ByteString)

-- | Create stream of strict bytestrings from <a>Put</a> value.
sourcePut :: MonadThrow m => Put -> Producer m ByteString

-- | Decode message from input stream.
sinkGet :: MonadThrow m => Get b -> Consumer ByteString m b
data ParseError
ParseError :: ByteString -> ByteOffset -> String -> ParseError

-- | Data left unconsumed in single stream input value.
[unconsumed] :: ParseError -> ByteString

-- | Number of bytes consumed from single stream input value.
[offset] :: ParseError -> ByteOffset

-- | Error content.
[content] :: ParseError -> String
instance GHC.Show.Show Data.Conduit.Serialization.Binary.ParseError
instance GHC.Exception.Exception Data.Conduit.Serialization.Binary.ParseError
