feat: marshalers to codecs

This commit is contained in:
2026-02-07 00:36:05 -05:00
parent b61ca744e0
commit 30382bee7e
9 changed files with 79 additions and 107 deletions

View File

@@ -1,8 +1,8 @@
package codec
type Codec[T, U any] interface {
Encode(T) (U, error)
Decode(U) (T, error)
}
type Conversion[T, U any] = func(T) (U, error)
type Marshaler[T any] = Codec[T, string]
type Codec[T any] interface {
Encode(T) (string, error)
Decode(string) (T, error)
}