summary refs log tree commit diff stats
path: root/tests/converter/t7098.nim
blob: 8e7634882a71ce93151d960e80eb26c9b689657a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
discard """
action: compile
"""

type
  Byte* = uint8
  Bytes* = seq[Byte]

  BytesRange* = object
    bytes: Bytes
    ibegin, iend: int

proc initBytesRange*(s: var Bytes, ibegin = 0, iend = -1): BytesRange =
  let e = if iend < 0: s.len + iend + 1
          else: iend
  assert ibegin >= 0 and e <= s.len

  shallow(s)
  result.bytes = s
  result.ibegin = ibegin
  result.iend = e

converter fromSeq*(s: Bytes): BytesRange =
  var seqCopy = s
  return initBytesRange(seqCopy)

type
  Reader* = object
    data: BytesRange
    position: int

proc readerFromBytes*(input: BytesRange): Reader =
  discard

let r = readerFromBytes(@[])