msg_marshal

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MashalFoo

func MashalFoo(f FooI, b []byte) ([]byte, error)

Types

type FooI

type FooI interface {
	String() string
	// implemented by msgp
	DecodeMsg(dc *msgp.Reader) (err error)
	EncodeMsg(en *msgp.Writer) (err error)
	MarshalMsg(b []byte) (o []byte, err error)
	UnmarshalMsg(bts []byte) (o []byte, err error)
	Msgsize() (s int)
	GetType() uint16
	GetName() string
}

func UnmarShalFoo

func UnmarShalFoo(b []byte) (o []byte, f FooI, err error)

type Person

type Person struct {
	Name string
	Age  int
	Type uint16
}

func (*Person) DecodeMsg

func (z *Person) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Person) EncodeMsg

func (z Person) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Person) GetName

func (p *Person) GetName() string

func (*Person) GetType

func (p *Person) GetType() uint16

func (Person) MarshalMsg

func (z Person) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Person) Msgsize

func (z Person) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Person) String

func (p Person) String() string

func (*Person) UnmarshalMsg

func (z *Person) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Student

type Student struct {
	Person
	Score int
}

func (*Student) DecodeMsg

func (z *Student) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Student) EncodeMsg

func (z *Student) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Student) MarshalMsg

func (z *Student) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Student) Msgsize

func (z *Student) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Student) String

func (s Student) String() string

func (*Student) UnmarshalMsg

func (z *Student) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Teacher

type Teacher struct {
	Person
	Teach bool
}

func (*Teacher) DecodeMsg

func (z *Teacher) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Teacher) EncodeMsg

func (z *Teacher) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Teacher) MarshalMsg

func (z *Teacher) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Teacher) Msgsize

func (z *Teacher) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Teacher) String

func (s Teacher) String() string

func (*Teacher) UnmarshalMsg

func (z *Teacher) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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