h&1M-      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd Safe-Inferred")*/12589:;<=?/eborshBig Endian valuefborshLittle Endian valuegborsh.Convert a value in cpu endianess to big endianhborsh5Convert from a big endian value to the cpu endiannessiborsh1Convert a value in cpu endianess to little endianjborsh8Convert from a little endian value to the cpu endianness klemnfopghij Safe-Inferred")*/12589:;<=?kqborsh#Peek at the start of the bytestringIf the bytestring is long enough, returns the value, the size of that value, and the remaining bytes.4Implementation note: this could be simplified using bytestring >= 0.11 , as the offset argument has been removed. As it stands, this implementation is backwards compatible.rborshO(1) splitAtEnd n xs is equivalent to (takeEnd n xs, dropEnd n xs) splitAtEnd 0 "abcde" == ("abcde", "") splitAtEnd 1 "abcde" == ("abcd", "e") splitAtEnd 5 "abcde" == ("", "abcde")$Edge cases, similar to behaviour of s:tborshWrapper around u with more sane return typevborshWrapper around w with more sane return typeqrtv Safe-Inferred")*/12589:;<=? xborsh/Bunch of chunks, starting at a particular pointThe chunks are stored in reverse order, and we cache their total length.borsh>The most common case: chunk of the input at a particular pointborsh(Value at a particular point in the inputborsh Offset in bytes within the inputyborshConcatenate all chunks togetherNOTE: This is expensive, and should be used only in exception circumstances.zborsh Add chunkThis does not affect the offset, since the chunk is (logically) at the end of the already-known chunks{borshSplit chunks at the required length, if sufficient chunks are availablePrecondition: if the accumulated length exceeds the required length, we must be able to split the mostly added chunk to make up for the difference. x|yz{  Safe-Inferred")*/12589:;<=? borshError type for deserialisation.}borshMonad for incremental decoding Think of }= as the monad we use for processing the full input, whereas Decoder> is the monad used for processing a single chunk of the input.borsh5The position of the decoder when the failure occurredborshMessage explaining the failure~}  Safe-Inferred")*/12589:;<=? borsh9The decoder terminated successfully: we can stop decodingborsh#The decoder failed: we should abort borsh2The decoder needs more data before it can continueNOTE: The decoder that is waiting for more data may not be (and typically will not be) the decoder we started with in : in the typical case, a bunch of values will have been decoded successfully before we get to a (continuation) decoder that requires data beyond the current chunk. borsh6Large token of known length that spans multiple chunksThis is NOT incremental: all chunks will be read into memory before the function is applied. Primarily useful for large types that are not easily split into (valid) chunks, such as UTF8-encoded text (if were wanted to split that, we'd have to split it at UTF8 boundaries).The continuation will be called with a lazy bytestring of precisely the requested length (provided enough input is available, of course), along with the remaining input token to be provided to the continuation decoder. borshIncremental interfaceWhen decoding large objects such as lists, we do not want to bring all required chunks into memory before decoding the list. Instead, we want to decode the list elements as we go. In this case,   can be used to repeatedly decode a value using decoder for the elements; when all elements have been processed, the continuation decoder is called.:NOTE: This interface is incremental in the sense that the  input chunks are read one at a time. It is NOT incremental in the generated output. borsh Variation on  $, where we do not accumulate resultsThis is useful for example for datatypes that we can update imperatively, such as mutable arrays. It could also be used to skip over unused parts of the input. borshDecoderA decoder describes how to match against a single chunk of the input.borshTop-level entry pointWe start without any input at all (and depending on the specific decoder, we may never need any).borsh#Run decoder against specified chunkborshProcess decoder resultborsh Auxiliary to ): process token that spans multple chunksPrecondition: if the accumulated length exceeds the required length, we must be able to split the mostly added chunk to make up for the difference.borsh Auxiliary to : incremental decodingborshImperative version of See   for discussion. borshRequired number of bytes borsh'How often to repeat the smaller decoderborshDecoder to repeatborshProcess all elements borsh'How often to repeat the smaller decoderborsh6Decoder to repeat (imperatively handling each element)borsh ContinuationborshRequired total sizeborsh Continuationborsh Current chunkborshNumber of elements requiredborshDecoder to repeatborsh+Continuation once we processed all elementsborsh Current chunkborshNumber of elements requiredborshDecoder to repeatborsh+Continuation once we processed all elementsborsh Current chunk   Safe-Inferred")*/12589:;<=?      Safe-Inferred#)*/012589:;<=?} Safe-Inferred")*/12589:;<=?borshMutable fixed-size arraysborshFixed size arraysFixedSizeArray n a. is the Haskell counter-part to the Rust type [A; N]..NOTE: For convenience, this is an instance of , but the invariant that the length of the vector should never change is not currently checked.borsh Construct  from list of unknown sizeThrows an exception if the list does not have the right number of elements.borsh Construct  from array of unknown size>Throws an exception if the array does not have the right size.borsh Construct # from mutable array of unknown size>Throws an exception if the array does not have the right size.borsh3Construct new mutable array of the appropriate sizeNone#)*/125689:;<=?9&borshSigned 128-bit wordImplementation note: this currently relies on the implementation of the  -https://hackage.haskell.org/package/wide-word wide-word? package, with some additional instances. However, the use of  wide-word' is not part of the public API of the borsh package.'borsh Construct an &(borsh)Get the most significant 64 bits from an &)borsh*Get the least significant 64 bits from an &'borshMost significant bitsborshLeast significant bits&'()&'()None#)*/125689:;<=?!:borshUnsigned 128-bit wordImplementation note: this currently relies on the implementation of the  -https://hackage.haskell.org/package/wide-word wide-word? package, with some additional instances. However, the use of  wide-word' is not part of the public API of the borsh package.;borsh Construct a :<borsh(Get the most significant 64 bits from a :=borsh)Get the least significant 64 bits from a :;borshMost significant bitsborshLeast significant bits:;<=:;<=  Safe-Inferred")*/12589:;<=?"0borshBit-for-bit copy from a to b  Safe-Inferred")*/12589:;<=?"NborshEncoderAn encoder describes how to serialise a given value in BORSH format.NOP Safe-Inferred")*/12589:;<=?#u Safe-Inferred#)*/012589:;<=?,j QborshAuxiliary class to  BorshSize describing the conditions under which the size of the encoding of a value of a sum-type is known.borshType-level composition of ] and [borshA sum of products has known size if it has at most one constructor, and all arguments of that constructor have known sizeborsh Auxiliary to Defined in such a way that we know the result is of variable size as soon as we encounter the first type of variable size (independent of the tail).borshA product of types has known size if all types in the products doSborsh Deriving-via support for structsThe Borsh spec  https://borsh.io/ mandates that enums have a tag indicating the constructor, even when there is only a single constructor in the enum. In Rust this makes more sense than in Haskell, since in Rust enums and structs are introduced through different keywords. In Haskell, of course, the only difference between them is that a struct is an enum with a single constructor.2The default generic encoder en decoder you get in X and V will therefore add the tag, independent of the number of constructors. If you want the encoding of a struct, without the tag, you need to use deriving via: data MyStruct = .. deriving (BorshSize, ToBorsh, FromBorsh) via Struct MyStructNOTE: Doing so may have consequences for forwards compatibility: if a tag is present, additional constructors can be added without invalidating the encoding of existing constructors.WborshDecode from BorshSee Y( for discussion of the generic instance.YborshEncoder to BorshNOTE: The default generic encoder uses the Borsh encoding for enums, and will therefore use constructor tag; see S for detailed discussion. Since the spec mandates the presence of that constructor tag, the generic encoder/decoder does not apply to types without constructors.\borsh2Size of the Borsh encoding, if known ahead of timeSee Y( for discussion of the generic instance.]borshThe statically known size of encodings of values of a particular type.QRSTUVWXYZ[\]^_`abcd Safe-Inferred")*/12589:;<=?, NOPQRSTUVWXYZ[\]^_`abcdXYNOPcVW dZ[\]^_`abQRSTU               ! " #$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ \ \ ]^_``abcdefghijklmnopqrstuvwxqyrz{|}~                                             "borsh-0.1.0-EYotOIfH82D95P7C5ms1GgCodec.Borsh.IncrementalData.FixedSizeArray Data.Int128 Data.Word128 Codec.Borsh"Codec.Borsh.Internal.Util.ByteSwap$Codec.Borsh.Internal.Util.ByteStringCodec.Borsh.Incremental.LocatedCodec.Borsh.Incremental.MonadCodec.Borsh.Incremental.DecoderCodec.Borsh.Internal.Util.SOP%Codec.Borsh.Internal.Util.BitwiseCastCodec.Borsh.EncodingCodec.Borsh.DecodingCodec.Borsh.Class LocatedChunkLocatedL ByteOffsetDeserialiseFailure DecodeResult DecodeDone DecodeFailDecodeNeedsDataDecodeLargeTokenDecodeIncrementalDecodeIncremental_Decoder matchChunk liftDecoderdecodeLittleEndiandecodeLargeTokendecodeIncrementaldecodeIncremental_deserialiseByteStringMFixedSizeArraytoMArrayFixedSizeArraytoArrayfromList fromArray fromMArraynew$fVectorFixedSizeArraya$fTraversableFixedSizeArray$fMVectorMFixedSizeArraya$fShowFixedSizeArray$fEqFixedSizeArray$fOrdFixedSizeArray$fFunctorFixedSizeArray$fFoldableFixedSizeArrayInt128int128 int128MS64 int128LS64$fByteSwapInt128 $fDataInt128 $fBitsInt128$fBoundedInt128 $fEnumInt128 $fEqInt128$fFiniteBitsInt128$fGenericInt128$fIntegralInt128 $fIxInt128 $fNumInt128 $fOrdInt128 $fReadInt128 $fRealInt128 $fShowInt128$fStorableInt128Word128word128 word128MS64 word128LS64$fByteSwapWord128 $fDataWord128 $fBitsWord128$fBoundedWord128 $fEnumWord128 $fEqWord128$fFiniteBitsWord128$fGenericWord128$fIntegralWord128 $fIxWord128 $fNumWord128 $fOrdWord128 $fReadWord128 $fRealWord128 $fShowWord128$fStorableWord128Encoder runEncoder BorshSizeSum borshSizeSumStruct getStruct FromBorsh decodeBorshToBorsh encodeBorsh BorshSizeStaticBorshSize borshSizeSize SizeKnown SizeVariable KnownSize HasKnownSizeHasVariableSizeserialiseBorshdeserialiseBorshBELEtoBEfromBEtoLEfromLEByteSwapbyteSwapunBEunLEpeekByteString splitAtEndbaseGHC.ListsplitAt lengthStrictbytestring-0.11.3.1Data.ByteStringlength lengthLazyData.ByteString.Lazy LocatedChunksfromLocatedChunksaddChunk splitChunkstoLocatedChunksIncrIDecode IDecodeDoneIDecodePartial IDecodeFailgetIncrrunIncrliftIncr needChunk decodeFail runIDecode runDecoderrunWith processResultprocessLargeTokenprocessIncrementalprocessIncremental_indices&vector-0.13.0.0-7U8pFThXyYFEKl1vrDAyiEData.Vector.Generic.BaseVectorcastBits BitwiseCastencodeU8 encodeU16 encodeU32 encodeU64encodeI8 encodeI16 encodeI32 encodeI64 encodeF32 encodeF64 encodeU128 encodeI128 encodeString encodeArray encodeVec encodeOption encodeHashSet encodeHashMap encodeStruct encodeEnumencodeLazyByteStringencodeStrictByteString encodeChar encodeBooldecodeU8 decodeU16 decodeU32 decodeU64 decodeU128decodeI8 decodeI16 decodeI32 decodeI64 decodeI128 decodeF32 decodeF64 decodeString decodeArray decodeVec decodeOption decodeHashSet decodeHashMap decodeStruct decodeEnumdecodeLazyByteStringdecodeStrictByteString decodeChar decodeBoolSoK SumKnownSize ProdKnownAux ProdKnownSize