Files
lattigo/utils/structs/structs.go
Christian Mouchet 28d498ffc7 improved Vector, Matrix and Map types
Vector and Matrix now use []T and [][]T as underlying types, which makes them more versatile and easy to cast to from slices.
Map still uses map[K]V as map values cannot be addressed and this is anoying to use.
I also got rid of the Codec[T] type as it can be replaced with a 3-liner (i.e., equivalent to calling the Codex and checking the error).
There is also a small change of the OperendQ.Encode method that now uses OperandQ.WriteTo instead of OperandQ.Encode (since it is a bit fasterfor some reason...). This is an experiment and more work on the serialization is needed.
2023-06-07 20:18:13 +02:00

19 lines
364 B
Go

// Package structs implements helpers to generalize vectors and matrices of structs, as well as their serialization.
package structs
type CopyNewer[V any] interface {
CopyNew() *V
}
type BinarySizer interface {
BinarySize() int
}
type Encoder interface {
Encode(p []byte) (n int, err error)
}
type Decoder interface {
Decode(p []byte) (n int, err error)
}