LoadSlice loads the slice elements from s into a go-slice of the slice type.
(ctx context.Context, s Slice, pools Pools, l *device.MemoryLayout)
| 25 | |
| 26 | // LoadSlice loads the slice elements from s into a go-slice of the slice type. |
| 27 | func LoadSlice(ctx context.Context, s Slice, pools Pools, l *device.MemoryLayout) (interface{}, error) { |
| 28 | pool := pools.MustGet(s.Pool()) |
| 29 | rng := Range{s.Base(), s.Size()} |
| 30 | ioR := pool.Slice(rng).NewReader(ctx) |
| 31 | binR := endian.Reader(ioR, l.GetEndian()) |
| 32 | d := NewDecoder(binR, l) |
| 33 | count := int(s.Count()) |
| 34 | sli := slice.New(reflect.SliceOf(s.ElementType()), count, count) |
| 35 | Read(d, sli.Addr().Interface()) |
| 36 | if err := binR.Error(); err != nil { |
| 37 | return nil, err |
| 38 | } |
| 39 | return sli.Interface(), nil |
| 40 | } |
| 41 | |
| 42 | // LoadPointer loads the element from p. |
| 43 | func LoadPointer(ctx context.Context, p Pointer, pools Pools, l *device.MemoryLayout) (interface{}, error) { |
nothing calls this directly
no test coverage detected