Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Fractus ¶
type Fractus struct {
// Opts controls unsafe behaviour (zero-copy) and alignment checks.
Opts SafeOptions
// contains filtered or unexported fields
}
func NewFractus ¶
func NewFractus(opts SafeOptions) *Fractus
NewFractus constructs a new Fractus encoder/decoder. Fractus can be used for both encoding and decoding. Provide SafeOptions to opt into unsafe, zero-copy modes.
func (*Fractus) Decode ¶
/ *** Decode turns the provided byte slice into value The type of the decoded values should be compatible with the respective values in out. Decode reads a Fractus-encoded byte slice into the provided struct pointer. If unsafe modes are enabled decoded strings/slices may alias the original input buffer; the caller must ensure the input remains valid while values are used. For a safe wrapper that retains the payload, use `SafeDecoder`.
func (*Fractus) Encode ¶
Encode turns the value provided into a byte slice(Fractus format binary) The binary reflect the value encoded only struct are accepted, only exported values are encoded Encode serializes the provided struct value into Fractus binary format. Only exported struct fields are encoded. Caller may enable zero-copy modes via `Opts` but must then ensure the source buffer remains live.
type SafeDecoder ¶
type SafeDecoder struct {
// contains filtered or unexported fields
}
SafeDecoder for memory lifetime management Ensure that Decoding using unsafe doesn't affect values SafeDecoder keeps a reference to the payload to ensure any zero-copy references produced by `Fractus.Decode` remain valid for the lifetime of the SafeDecoder value.
func NewSafeDecoder ¶
func NewSafeDecoder(fractus *Fractus) *SafeDecoder