| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cardano.Crypto.PackedBytes
Synopsis
- data PackedBytes (n ∷ Nat)
- packByteString ∷ ∀ n m. (KnownNat n, MonadFail m) ⇒ ByteString → m (PackedBytes n)
- packShortByteString ∷ ∀ n m. (KnownNat n, MonadFail m) ⇒ ShortByteString → m (PackedBytes n)
- packShortByteStringWithOffset ∷ ∀ n m. (KnownNat n, MonadFail m) ⇒ ShortByteString → Int → m (PackedBytes n)
- unpackBytes ∷ PackedBytes n → ShortByteString
- unpackAsByteArray ∷ PackedBytes n → ByteArray
- unpackPinnedBytes ∷ PackedBytes n → ByteString
Documentation
data PackedBytes (n ∷ Nat) Source #
Instances
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