coder

package
v3.0.0-...-4803698 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(t T, v any) (data []byte, err error)

NOTE: 这里放弃了zero-copy设计,因为涉及了有sendChan,这种架构下zero-copy不现实,所以返回的data,必须是新分配的内存 极致修复,就是使用RingBuffer的架构,就可以做到zero-copy 参考: gnet, evio, nbio

func RegisterCoder

func RegisterCoder(t T, coder Coder)

func Unmarshal

func Unmarshal(t T, data []byte, v any) error

Types

type Coder

type Coder interface {
	Marshal(any) ([]byte, error)
	Unmarshal([]byte, any) error
}

type T

type T uint8
const (
	Raw T = iota
	JSON
	Msgp
)

func (T) String

func (t T) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL