cardano-crypto-class-2.3.0.0: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.PackedBytes

Synopsis

Documentation

data PackedBytes (n ∷ Nat) Source #

Instances

Instances details
KnownNat n ⇒ FromCBOR (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

KnownNat n ⇒ ToCBOR (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

Methods

toCBORPackedBytes n → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (PackedBytes n) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [PackedBytes n] → Size Source #

NFData (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

Methods

rnfPackedBytes n → () #

Eq (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

Methods

(==)PackedBytes n → PackedBytes n → Bool #

(/=)PackedBytes n → PackedBytes n → Bool #

Ord (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

KnownNat n ⇒ MemPack (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

NoThunks (PackedBytes n) Source # 
Instance details

Defined in Cardano.Crypto.PackedBytes.Internal

packByteString ∷ ∀ n m. (KnownNat n, MonadFail m) ⇒ ByteString → m (PackedBytes n) Source #

Construct PackedBytes from a ShortByteString. This function is safe and will fail if the buffer size does not match expected size of packed bytes exactly.

Since: 2.3.0.0

packShortByteString ∷ ∀ n m. (KnownNat n, MonadFail m) ⇒ ShortByteString → m (PackedBytes n) Source #

Construct PackedBytes from a ShortByteString. This function is safe and will fail if the buffer size does not match expected size of packed bytes exactly.

Since: 2.3.0.0

packShortByteStringWithOffset Source #

Arguments

∷ ∀ n m. (KnownNat n, MonadFail m) 
ShortByteString

Buffer to read data from

Int

Non-negative offset into the buffer, where packing will start from.

→ m (PackedBytes n) 

Construct PackedBytes from a ShortByteString and a non-negative offset in number of bytes from the beginning. This function is safe, but it only checks whether there are enough bytes. I.e. it doesn't enforce full buffer consumption. If you need to check that buffer has no other data except what is being packed, then use packShortByteString instead

Since: 2.2.4.0