Categorygithub.com/iotaledger/hive.go/serializer/v2
modulepackage
2.0.0-rc.1
Repository: https://github.com/iotaledger/hive.go.git
Documentation: pkg.go.dev

# Functions

CheckExactByteLength checks that the given length equals exact.
CheckMinByteLength checks that length is min.
CheckType checks that the denoted type equals the shouldType.
CheckTypeByte checks that the denoted type byte equals the shouldType.
NewDeserializer creates a new Deserializer.
NewSerializer creates a new Serializer.
RemoveDupsAndSortByLexicalOrderArrayOf32Bytes returns a new SliceOfArraysOf32Bytes sorted by lexical order and without duplicates.

# Constants

ArrayValidationModeAtMostOneOfEachTypeByte instructs the array validation to allow a given type prefix byte to occur only once in the array.
ArrayValidationModeAtMostOneOfEachTypeUint32 instructs the array validation to allow a given type prefix uint32 to occur only once in the array.
ArrayValidationModeLexicalOrdering instructs the array validation to check for lexical order.
ArrayValidationModeNoDuplicates instructs the array validation to check for duplicates.
ArrayValidationModeNone instructs the array validation to perform no validation.
DeSeriModeNoValidation instructs de/serialization to perform no validation.
DeSeriModePerformLexicalOrdering instructs de/deserialization to automatically perform ordering of certain arrays by their lexical serialized form.
DeSeriModePerformValidation instructs de/serialization to perform validation.
Float32ByteSize is the byte size of a float32.
Float64ByteSize is the byte size of a float64.
Int16ByteSize is the byte size of an int16.
Int32ByteSize is the byte size of an int32.
Int64ByteSize is the byte size of an int64.
MinPayloadByteSize is the minimum size of a payload (together with its length denotation).
OneByte is the byte size of a single byte.
PayloadLengthByteSize is the size of the payload length denoting bytes.
SeriLengthPrefixTypeAsByte defines a collection length to be denoted by a byte.
SeriLengthPrefixTypeAsUint16 defines a collection length to be denoted by a uint16.
SeriLengthPrefixTypeAsUint32 defines a collection length to be denoted by a uint32.
SmallTypeDenotationByteSize is the size of a type denotation for a small range of possible values.
TypeDenotationByte defines a denotation which defines a type ID by a byte.
TypeDenotationByteSize is the size of a type denotation.
TypeDenotationNone defines that there is no type denotation.
TypeDenotationUint32 defines a denotation which defines a type ID by a uint32.
UInt16ByteSize is the byte size of a uint16.
UInt256ByteSize is the byte size of an uint256.
UInt32ByteSize is the byte size of a uint32.
UInt64ByteSize is the byte size of an uint64.

# Variables

ErrArrayValidationMaxElementsExceeded gets returned if the count of elements is too big.
ErrArrayValidationMinElementsNotReached gets returned if the count of elements is too small.
ErrArrayValidationOrderViolatesLexicalOrder gets returned if the array elements are not in lexical order.
ErrArrayValidationTypesNotOccurred gets returned if not all types as specified in an ArrayRules.MustOccur are in an array.
ErrArrayValidationViolatesTypeUniqueness gets returned if the array contains the same type multiple times.
ErrArrayValidationViolatesUniqueness gets returned if the array elements are not unique.
ErrDeserializationInvalidBoolValue gets returned when a bool value is tried to be read but it is neither 0 or 1.
ErrDeserializationLengthInvalid gets returned if a length denotation exceeds a specified limit.
ErrDeserializationNotAllConsumed gets returned if not all bytes were consumed during deserialization of a given type.
ErrDeserializationNotEnoughData gets returned if there is not enough data available to deserialize a given object.
ErrDeserializationTypeMismatch gets returned when a denoted type for a given object is mismatched.
ErrInvalidBytes gets returned when data is invalid for deserialization.
ErrSliceLengthTooLong gets returned if a slice exceeds a max length.
ErrSliceLengthTooShort gets returned if a slice is less than a min length.
ErrStringTooLong gets returned if a string exceeds a max length.
ErrStringTooShort gets returned if a string is less than a min length.
ErrUint256Nil gets returned when a uint256 *big.Int is nil.
ErrUint256NumNegative gets returned if a supposed uint256 has a sign bit.
ErrUint256TooBig gets returned when a supposed uint256 big.Int value is more than 32 bytes in size.
ErrUnknownArrayValidationMode gets returned for unknown array validation modes.

# Structs

ArrayRules defines rules around a to be deserialized array.
Deserializer is a utility to deserialize bytes.
SerializableGuard defines the guards to de/serialize Serializable.
Serializer is a utility to serialize bytes.

# Interfaces

Serializable is something which knows how to serialize/deserialize itself from/into bytes while also performing syntactical checks on the written/read data.
SerializableSlice is a slice of a type which can convert itself to Serializables.
SerializableWithSize implements Serializable interface and has the extra functionality of returning the size of the resulting serialized object (ideally without actually serializing it).

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ArrayValidationMode defines the mode of array validation.
DeSerializationMode defines the mode of de/serialization.
DeserializeFunc is a function that reads bytes from b and returns how much bytes was read.
ElementUniquenessSliceFunc is a function which takes a byte slice and reduces it to the part which is deemed relevant for uniqueness checks.
ElementValidationFunc is a function which runs during array validation (e.g.
No description provided by the author
No description provided by the author
No description provided by the author
LexicalOrdered32ByteArrays are 32 byte arrays ordered in lexical order.
LexicalOrderedByteSlices are byte slices ordered in lexical order.
No description provided by the author
No description provided by the author
SerializablePostReadGuardFunc is a function which inspects the read Serializable add runs additional validation against it.
SerializableReadGuardFunc is a function that given a type prefix, returns an empty instance of the given underlying type.
Serializables is a slice of Serializable.
SerializableWriteGuardFunc is a function that given a Serializable, tells whether the given type is allowed to be serialized.
SeriLengthPrefixType defines the type of the value denoting the length of a collection.
No description provided by the author
No description provided by the author
SortedSerializables are Serializables sorted by their serialized form.
TypeDenotationType defines a type denotation.
TypePrefixes defines a set of type prefixes.