// Send a marshaled binary to the tcp socket.
979873
func (self *SocketHandler) sendTCP(bin []byte) error {
	if self.conn == nil {
		err := self.createSocket()
		if err != nil {
			return err
		}
	}
	sentSoFar, left := 0, len(bin)
	for left > 0 {
		sent, err := self.conn.Write(bin[sentSoFar:])
		if err != nil {
			return err
		}
		sentSoFar += sent
		left -= sent
	}
	return nil
}
3413
func (p ProtobufImpl) Marshal(msg proto.Message) ([]byte, error) {
	res, err := proto.Marshal(msg)
	return res, errors.WithStack(err)
}
348466
func (m *StatusResponseCilium) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1243462
func (p PingSlotInfoReqPayload) MarshalBinary() ([]byte, error) {
	if p.Periodicity > 7 {
		return nil, errors.New("lorawan: max value of Periodicity is 7")
	}

	return []byte{byte(p.Periodicity)}, nil
}
226031
func (m *Client) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
874193
func (cn *conn) send(m *writeBuf) {
	b := (*m)[1:]
	binary.BigEndian.PutUint32(b, uint32(len(b)))

	if (*m)[0] == 0 {
		*m = b
	}

	_, err := cn.c.Write(*m)
	if err != nil {
		panic(err)
	}
}
613819
func (m *Marshaller) Marshal(obj interface{}) ([]byte, error) {
	var buf bytes.Buffer
	if err := m.Encode(obj, &buf); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
52954
func (Serializer) Marshal(m pilosa.Message) ([]byte, error) {
	pm := encodeToProto(m)
	if pm == nil {
		return nil, errors.New("passed invalid pilosa.Message")
	}
	buf, err := proto.Marshal(pm)
	return buf, errors.Wrap(err, "marshalling")
}
441102
func (m *HandledConsentRequest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
994413
func (m *StatusResponseClusterNodesItems0PrimaryAddress) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
423514
func (s *Socket) Send(parts [][]byte) (err error) {
	for _, part := range parts[:len(parts)-1] {
		if err = s.SendPart(part, true); err != nil {
			return
		}
	}
	return s.SendPart(parts[len(parts)-1], false)
}
570681
func (soc *Socket) SendBytes(data []byte, flags Flag) (int, error) {
	if !soc.opened {
		return 0, ErrorSocketClosed
	}
	datac := C.CString(string(data))
	var msg C.zmq_msg_t
	if i, err := C.my_msg_init_data(&msg, unsafe.Pointer(datac), C.size_t(len(data))); i != 0 {
		return -1, errget(err)
	}
	defer C.zmq_msg_close(&msg)
	n, err := C.zmq_send(soc.soc, &msg, C.int(flags))
	if n != 0 {
		return -1, errget(err)
	}
	return int(n), nil
}
14822
func (i IP) MarshalBinary() ([]byte, error) {
	return []byte(i[:net.IPv4len]), nil
}
276549
func Marshal(in interface{}) (out []byte, err error) {
	var w writer
	m, ok := in.(yaml.MapSlice)
	if !ok {
		return nil, errors.New("invalid type passed to Marshal")
	}
	w.writeMap(m, "")
	w.writeString("\n")
	return w.bytes(), err
}
37286
func (r *Packet) MarshalBinary() ([]byte, error) {
	r.Header.PacketSize = packetSize(r)

	buf, _ := MarshalBinary(r.Header)

	return append(buf, r.Payload...), nil
}
441299
func (o Options) MarshalBinary() ([]byte, error) {
	b := buffer.New(nil)
	for _, code := range o.sortedCodes() {
		for _, data := range o[code] {
			// 2 bytes: option code
			b.Write16(uint16(code))

			// 2 bytes: option length
			b.Write16(uint16(len(data)))

			// N bytes: option data
			b.WriteBytes(data)
		}
	}
	return b.Data(), nil
}
598691
func (t UnixTime) MarshalBinary() ([]byte, error) {
	buf := &bytes.Buffer{}

	payload := int64(t.Duration())

	if err := binary.Write(buf, binary.LittleEndian, &payload); err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}