MCPcopy
hub / github.com/tinylib/msgp / writeSlice

Method writeSlice

msgp/write.go:821–839  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

819}
820
821func (mw *Writer) writeSlice(v reflect.Value) (err error) {
822 // is []byte
823 if v.Type().ConvertibleTo(btsType) {
824 return mw.WriteBytes(v.Bytes())
825 }
826
827 sz := uint32(v.Len())
828 err = mw.WriteArrayHeader(sz)
829 if err != nil {
830 return
831 }
832 for i := range sz {
833 err = mw.WriteIntf(v.Index(int(i)).Interface())
834 if err != nil {
835 return
836 }
837 }
838 return
839}
840
841// is the reflect.Kind encodable?
842func isSupported(k reflect.Kind) bool {

Callers 1

WriteIntfMethod · 0.95

Calls 5

WriteBytesMethod · 0.95
WriteArrayHeaderMethod · 0.95
WriteIntfMethod · 0.95
TypeMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected