Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InvalidUnmarshalError ¶
An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)
func (*InvalidUnmarshalError) Error ¶
func (e *InvalidUnmarshalError) Error() string
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into valid Bencode.
type MarshalerError ¶
A MarshalerError is returned by Marshal when marshal fail
func (*MarshalerError) Error ¶
func (e *MarshalerError) Error() string
type RawMessage ¶
type RawMessage []byte
RawMessage is a raw encoded bencode value.
func (RawMessage) MarshalBencode ¶
func (m RawMessage) MarshalBencode() ([]byte, error)
MarshalBencode returns m as the JSON encoding of m.
func (*RawMessage) UnmarshalBencode ¶
func (m *RawMessage) UnmarshalBencode(data []byte) error
UnmarshalBencode sets *m to a copy of data.
type SyntaxError ¶
type SyntaxError struct { Offset int64 // contains filtered or unexported fields }
A SyntaxError is a description of a Bencode syntax error.
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
type UnmarshalTypeError ¶
type UnmarshalTypeError struct { Value string // description of Bencode value - "bool", "array", "number -5" Type reflect.Type // type of Go value it could not be assigned to Offset int64 // error occurred after reading Offset bytes Struct string // name of the struct type containing the field Field string // name of the field holding the Go value }
An UnmarshalTypeError describes a Bencode value that was not appropriate for a value of a specific Go type.
func (*UnmarshalTypeError) Error ¶
func (e *UnmarshalTypeError) Error() string
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can unmarshal a Bencode description of themselves. The input can be assumed to be a valid encoding of a Bencode value. UnmarshalBencode must copy the Bencode data if it wishes to retain the data after returning.
By convention, to approximate the behavior of Unmarshal itself, Unmarshalers implement UnmarshalBencode([]byte("null")) as a no-op.
type UnsupportedTypeError ¶
An UnsupportedTypeError is returned by Marshal when attempting to encode an unsupported value type.
func (*UnsupportedTypeError) Error ¶
func (e *UnsupportedTypeError) Error() string