{"modulePath":"github.com/lasthyphen/binarytwo","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package reflectcodec\n\n## Constants\n\n```go\nconst (\n\t// SliceLenTagName that specifies the length of a slice.\n\tSliceLenTagName = \"len\"\n\n\t// TagValue is the value the tag must have to be serialized.\n\tTagValue = \"true\"\n)\n```\n\n```go\nconst (\n\t// DefaultTagName that enables serialization.\n\tDefaultTagName = \"serialize\"\n)\n```\n\n## Functions\n\n```go\nfunc New(typer TypeCodec, tagName string, maxSliceLen uint32) codec.Codec\n```\nNew returns a new, concurrency-safe codec\n\n## Types\n\n```go\ntype FieldDesc struct {\n\tIndex       int\n\tMaxSliceLen uint32\n}\n```\n\n```go\ntype StructFielder interface {\n\t// Returns the fields that have been marked as serializable in [t], which is\n\t// a struct type. Additionally, returns the custom maximum length slice that\n\t// may be serialized into the field, if any.\n\t// Returns an error if a field has tag \"[tagName]: [TagValue]\" but the field\n\t// is un-exported.\n\t// GetSerializedField(Foo) --\u003e [1,5,8] means Foo.Field(1), Foo.Field(5),\n\t// Foo.Field(8) are to be serialized/deserialized.\n\tGetSerializedFields(t reflect.Type) ([]FieldDesc, error)\n}\n```\nStructFielder handles discovery of serializable fields in a struct.\n\n```go\nfunc NewStructFielder(tagName string, maxSliceLen uint32) StructFielder\n```\n\n```go\ntype TypeCodec interface {\n\t// UnpackPrefix unpacks the prefix of an interface from the given packer.\n\t// The prefix specifies the concrete type that the interface should be\n\t// deserialized into. This function returns a new instance of that concrete\n\t// type. The concrete type must implement the given type.\n\tUnpackPrefix(*wrappers.Packer, reflect.Type) (reflect.Value, error)\n\n\t// PackPrefix packs the prefix for the given type into the given packer.\n\t// This identifies the bytes that follow, which are the byte representation\n\t// of an interface, as having the given concrete type.\n\t// When deserializing the bytes, the prefix specifies which concrete type\n\t// to deserialize into.\n\tPackPrefix(*wrappers.Packer, reflect.Type) error\n}\n```\n\n","path":"github.com/lasthyphen/binarytwo/codec/reflectcodec","name":"reflectcodec","synopsis":"","isRedistributable":true}
