func (pkt *SubscribePacket) WriteTo(w io.Writer, version byte) (len int, err error) {
	var d int
	len, err = pkt.Header().WriteTo(w)
	if err != nil {
		return
	}
	d, err = writeInt(w, pkt.ID)
	len += d
	if err != nil {
		return
	}
	for _, topic := range pkt.Topics {
		d, err = writeString(w, topic.Name)
		len += d
		if err != nil {
			return
		}
		d, err = w.Write([]byte{topic.QoS})
		len += d
		if err != nil {
			return
		}
	}
	return
}
// WriteTo writes the packet to the io.Writer.
WriteTo writes the packet to the io.Writer.
// WriteTo writes the packet to the io . Writer .
func (pkt *SubscribePacket) WriteTo(w io.Writer, version byte) (len int, err error) {
	var d int
	len, err = pkt.Header().WriteTo(w)
	if err != nil {
		return
	}
	d, err = writeInt(w, pkt.ID)
	len += d
	if err != nil {
		return
	}
	for _, topic := range pkt.Topics {
		d, err = writeString(w, topic.Name)
		len += d
		if err != nil {
			return
		}
		d, err = w.Write([]byte{topic.QoS})
		len += d
		if err != nil {
			return
		}
	}
	return
}
func ( pkt * SubscribePacket ) WriteTo ( w io . Writer , version byte ) ( len int , err error ) { var d int len , err = pkt . Header ( ) . WriteTo ( w ) if err != nil { return } d , err = writeInt ( w , pkt . ID ) len += d if err != nil { return } for _ , topic := range pkt . Topics { d , err = writeString ( w , topic . Name ) len += d if err != nil { return } d , err = w . Write ( [ ] byte { topic . QoS } ) len += d if err != nil { return } } return }
WriteTo writes the packet to the io.Writer.
WriteTo writes the packet to the io . Writer .