code: func (d *RecordDecoder) Samples(rec []byte, samples []RefSample) ([]RefSample, error) {
  	dec := encoding.Decbuf{B: rec}
  
  	if RecordType(dec.Byte()) != RecordSamples {
  		return nil, errors.New("invalid record type")
  	}
  	if dec.Len() == 0 {
  		return samples, nil
  	}
  	var (
  		baseRef  = dec.Be64()
  		baseTime = dec.Be64int64()
  	)
  	for len(dec.B) > 0 && dec.Err() == nil {
  		dref := dec.Varint64()
  		dtime := dec.Varint64()
  		val := dec.Be64()
  
  		samples = append(samples, RefSample{
  			Ref: uint64(int64(baseRef) + dref),
  			T:   baseTime + dtime,
  			V:   math.Float64frombits(val),
  		})
  	}
  
  	if dec.Err() != nil {
  		return nil, errors.Wrapf(dec.Err(), "decode error after %d samples", len(samples))
  	}
  	if len(dec.B) > 0 {
  		return nil, errors.Errorf("unexpected %d bytes left in entry", len(dec.B))
  	}
  	return samples, nil
  }
docs: // Samples appends samples in rec to the given slice.