cardano-ledger-binary-1.3.2.0: Binary serialization library used throughout ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Binary.Encoding

Synopsis

Running decoders

serializeEncCBOR a ⇒ Version → a → ByteString Source #

Serialize a Haskell value with a EncCBOR instance to an external binary representation.

The output is represented as a lazy ByteString and is constructed incrementally.

serialize'EncCBOR a ⇒ Version → a → ByteString Source #

Serialize a Haskell value to an external binary representation.

The output is represented as a strict ByteString.

serializeBuilderEncCBOR a ⇒ Version → a → Builder Source #

Serialize into a Builder. Useful if you want to throw other ByteStrings around it.

Hash

hashWithEncoder ∷ ∀ h a. HashAlgorithm h ⇒ Version → (a → Encoding) → a → Hash h a Source #

hashEncCBOR ∷ ∀ h a. (HashAlgorithm h, EncCBOR a) ⇒ Version → a → Hash h a Source #

Nested CBOR-in-CBOR

encodeNestedCborEncCBOR a ⇒ a → Encoding Source #

Encode and serialise the given a and sorround it with the semantic tag 24 In CBOR diagnostic notation: >>> 24(hDEADBEEF)

encodeNestedCborBytesByteStringEncoding Source #

Like encodeNestedCbor, but assumes nothing about the shape of input object, so that it must be passed as a binary ByteString blob. It's the caller responsibility to ensure the input ByteString correspond indeed to valid, previously-serialised CBOR data.

Tools

runByteBuilderIntBuilderByteString Source #

Run a ByteString Builder using a strategy aimed at making smaller things efficiently.

It takes a size hint and produces a strict ByteString. This will be fast when the size hint is the same or slightly bigger than the true size.

Deprecated

encCBORMaybe ∷ (a → Encoding) → Maybe a → Encoding Source #

Deprecated: In favor of encodeMaybe