Tim McCormack
05/02/2024, 1:31 AMBytesEq
, which just adds some equality semantics on top of a ByteArray, as well as an intermediary class BytesSized
that adds init-time checking that the byte array is of an appropriate size. Is there a way I can generate serializers for all of these with one bit of code, or is each one going to need a separate custom serializer? I'm having trouble sorting through the options.
• BytesEq and BytesSized: https://codeberg.org/cavern/spelunk/src/commit/c2767e38ce7ac23785eb87c06a2dc5c9b3cda51f/src/main/kotlin/org/timmc/spelunk/Utils.kt#L641
• Various subclasses of those: https://codeberg.org/cavern/spelunk/src/commit/c2767e38ce7ac23785eb87c06a2dc5c9b3cda51f/src/main/kotlin/org/timmc/spelunk/Crypto.kt#L565Tim McCormack
05/02/2024, 1:35 AMclass CatalogFinderEntry(bytes: ByteArray): BytesEq(bytes)
-- this just adds type safety and equals/hash/toString. But I really just want to use a ByteArraySerializer any time it (or any BytesEq subclass) shows up as a field in some other class. Is that doable?Tim McCormack
05/03/2024, 1:35 PMTim McCormack
05/03/2024, 11:18 PM