// Encode a slice of references to message struct pointers ([]struct).
187266
func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error {
	var state errorState
	ss := structPointer_GetStructPointer(base, p.field)
	ss1 := structPointer_GetRefStructPointer(ss, field(0))
	size := p.stype.Size()
	l := structPointer_Len(base, p.field)
	for i := 0; i < l; i++ {
		structp := structPointer_Add(ss1, field(uintptr(i)*size))
		if structPointer_IsNil(structp) {
			return ErrRepeatedHasNil
		}

		// Can the object marshal itself?
		if p.isMarshaler {
			m := structPointer_Interface(structp, p.stype).(Marshaler)
			data, err := m.Marshal()
			if err != nil && !state.shouldContinue(err, nil) {
				return err
			}
			o.buf = append(o.buf, p.tagcode...)
			o.EncodeRawBytes(data)
			continue
		}

		o.buf = append(o.buf, p.tagcode...)
		err := o.enc_len_struct(p.stype, p.sprop, structp, &state)
		if err != nil && !state.shouldContinue(err, nil) {
			if err == ErrNil {
				return ErrRepeatedHasNil
			}
			return err
		}

	}
	return state.err
}
862560
func (tm *TaskMessage) Encode() (string, error) {
	jsonData, err := json.Marshal(tm)
	if err != nil {
		return "", err
	}
	encodedData := base64.StdEncoding.EncodeToString(jsonData)
	return encodedData, err
}
45463
func encode(data interface{}) ([]byte, error) {
	if data == nil {
		return nil, nil
	}
	buf := bytes.NewBuffer([]byte{})
	enc := gob.NewEncoder(buf)
	if err := enc.Encode(data); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
1062362
func (o *Buffer) dec_ref_struct_message(p *Properties, base structPointer) (err error) {
	raw, e := o.DecodeRawBytes(false)
	if e != nil {
		return e
	}

	// If the object can unmarshal itself, let it.
	if p.isUnmarshaler {
		panic("not supported, since this is a pointer receiver")
	}

	obuf := o.buf
	oi := o.index
	o.buf = raw
	o.index = 0

	bas := structPointer_FieldPointer(base, p.field)

	err = o.unmarshalType(p.stype, p.sprop, false, bas)
	o.buf = obuf
	o.index = oi

	return err
}
1224457
func (enc *encoder) Encode(vs ...interface{}) (err error) {
	defer func() {
		err, _ = recover().(error)
	}()
	for _, v := range vs {
		enc.encode(reflect.ValueOf(v), 0)
	}
	return nil
}
188136
func (z contype) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteUint8(uint8(z))
	if err != nil {
		return
	}
	return
}
790277
func (o *Buffer) enc_ref_struct_message(p *Properties, base structPointer) error {
	var state errorState
	structp := structPointer_GetRefStructPointer(base, p.field)
	if structPointer_IsNil(structp) {
		return ErrNil
	}

	// Can the object marshal itself?
	if p.isMarshaler {
		m := structPointer_Interface(structp, p.stype).(Marshaler)
		data, err := m.Marshal()
		if err != nil && !state.shouldContinue(err, nil) {
			return err
		}
		o.buf = append(o.buf, p.tagcode...)
		o.EncodeRawBytes(data)
		return nil
	}

	o.buf = append(o.buf, p.tagcode...)
	return o.enc_len_struct(p.stype, p.sprop, structp, &state)
}
272446
func (o *Buffer) dec_slice_ref_struct_message(p *Properties, base structPointer) error {
	return o.dec_slice_ref_struct(p, false, base)
}
916137
func (b GUE) Encode(i *GUEFields) {
	ctl := uint8(0)
	if i.Control {
		ctl = 1 << 5
	}
	b[typeHLen] = ctl | i.Type<<6 | (i.HeaderLength-4)/4
	b[encapProto] = i.Protocol
}
680075
func (r *ReferenceUpdateRequest) Encode(w io.Writer) error {
	if err := r.validate(); err != nil {
		return err
	}

	e := pktline.NewEncoder(w)

	if err := r.encodeShallow(e, r.Shallow); err != nil {
		return err
	}

	if err := r.encodeCommands(e, r.Commands, r.Capabilities); err != nil {
		return err
	}

	if r.Packfile != nil {
		if _, err := io.Copy(w, r.Packfile); err != nil {
			return err
		}

		return r.Packfile.Close()
	}

	return nil
}
462878
func (c *CommitSig) Encode(w io.Writer, pver uint32) error {
	return WriteElements(w,
		c.ChanID,
		c.CommitSig,
		c.HtlcSigs,
	)
}
22985
func (z *bitmapContainerShortIterator) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "ptr"
	err = en.Append(0x82, 0xa3, 0x70, 0x74, 0x72)
	if err != nil {
		return err
	}
	if z.ptr == nil {
		err = en.WriteNil()
		if err != nil {
			return
		}
	} else {
		// map header, size 2
		// write "cardinality"
		err = en.Append(0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
		if err != nil {
			return err
		}
		err = en.WriteInt(z.ptr.cardinality)
		if err != nil {
			return
		}
		// write "bitmap"
		err = en.Append(0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
		if err != nil {
			return err
		}
		err = en.WriteArrayHeader(uint32(len(z.ptr.bitmap)))
		if err != nil {
			return
		}
		for zwht := range z.ptr.bitmap {
			err = en.WriteUint64(z.ptr.bitmap[zwht])
			if err != nil {
				return
			}
		}
	}
	// write "i"
	err = en.Append(0xa1, 0x69)
	if err != nil {
		return err
	}
	err = en.WriteInt(z.i)
	if err != nil {
		return
	}
	return
}
495507
func (codec *StringCodec) Encode(data interface{}, out *ByteBuf) error {
	if msg, ok := data.(string); ok {
		return out.WriteString(msg)
	}

	return fmt.Errorf("not string: %+v", data)
}
1233363
func (l *LogUpdate) Encode(w io.Writer) error {
	return WriteElements(w, l.LogIndex, l.UpdateMsg)
}
1205387
func (w *Stream) Encode(m JSONMessage) error {
	return w.enc.Encode(m)
}
864944
func (codec *SyncCodec) Encode(data interface{}, out *ByteBuf) error {
	if msg, ok := data.(*notifyRaw); ok {
		out.WriteByte(cmdNotifyRaw)
		out.WriteByteBuf(msg.buf)
		releaseNotifyRaw(msg)
		return nil
	} else if msg, ok := data.(*notify); ok {
		out.WriteByte(cmdNotify)
		out.WriteUint64(msg.offset)
		releaseNotify(msg)
		return nil
	} else if msg, ok := data.(*notifySync); ok {
		out.WriteByte(cmdNotifySync)
		out.WriteUint64(msg.offset)
		releaseNotifySync(msg)
		return nil
	} else if msg, ok := data.(*notifySyncRsp); ok {
		out.WriteByte(cmdNotifySyncRsp)
		out.WriteUint64(msg.offset)
		out.WriteByte(msg.count)
		out.WriteByteBuf(msg.buf)
		releaseNotifySyncRsp(msg)
		return nil
	} else if msg, ok := data.(*notifyHB); ok {
		out.WriteByte(cmdNotifyHB)
		out.WriteUint64(msg.offset)
		return nil
	}

	return fmt.Errorf("not support msg: %v", data)
}
241486
func (z *arrayContainer) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 1
	// write "content"
	err = en.Append(0x81, 0xa7, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.content)))
	if err != nil {
		return
	}
	for zxvk := range z.content {
		err = en.WriteUint16(z.content[zxvk])
		if err != nil {
			return
		}
	}
	return
}