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

Cardano.Ledger.Binary.Decoding.Sized

Synopsis

Documentation

data Sized a Source #

A CBOR deserialized value together with its size. When deserializing use either decodeSized or its DecCBOR instance.

Use mkSized to construct such value.

Constructors

Sized 

Fields

  • sizedValue ∷ !a
     
  • sizedSizeInt64

    Overhead in bytes. The field is lazy on purpose, because it might not be needed, but it can be expensive to compute.

Instances

Instances details
Generic (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Associated Types

type Rep (Sized a) ∷ TypeType Source #

Methods

fromSized a → Rep (Sized a) x Source #

toRep (Sized a) x → Sized a Source #

Show a ⇒ Show (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

showsPrecIntSized a → ShowS Source #

showSized a → String Source #

showList ∷ [Sized a] → ShowS Source #

DecCBOR a ⇒ DecCBOR (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

decCBORDecoder s (Sized a) Source #

dropCBORProxy (Sized a) → Decoder s () Source #

labelProxy (Sized a) → Text Source #

EncCBOR a ⇒ EncCBOR (Sized a) Source #

Discards the size.

Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

encCBORSized a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Sized a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Sized a] → Size Source #

NFData a ⇒ NFData (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

rnfSized a → () Source #

Eq a ⇒ Eq (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

(==)Sized a → Sized a → Bool Source #

(/=)Sized a → Sized a → Bool Source #

NoThunks a ⇒ NoThunks (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

type Rep (Sized a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

type Rep (Sized a) = D1 ('MetaData "Sized" "Cardano.Ledger.Binary.Decoding.Sized" "cardano-ledger-binary-1.3.3.0-inplace" 'False) (C1 ('MetaCons "Sized" 'PrefixI 'True) (S1 ('MetaSel ('Just "sizedValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "sizedSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)))

mkSizedEncCBOR a ⇒ Version → a → Sized a Source #

Construct a Sized value by serializing it first and recording the amount of bytes it requires. Note, however, CBOR serialization is not canonical, therefore it is *NOT* a requirement that this property holds:

sizedSize (mkSized a) === sizedSize (unsafeDeserialize (serialize a) :: a)

sizedDecoderDecoder s a → Decoder s (Sized a) Source #

Deprecated: In favor of more consistently named decodeSized

toSizedLEncCBOR s ⇒ VersionLens' s a → Lens' (Sized s) a Source #

Take a lens that operates on a particular type and convert it into a lens that operates on the Sized version of the type.