make Stream.{read,peek} procs public (#9806)
Those are useful in generic code, and `proc write*[T](s: Stream, x: T)` was already public.
This commit is contained in:
parent
0229dfd199
commit
11050d1104
1 changed files with 2 additions and 2 deletions
|
|
@ -146,12 +146,12 @@ proc writeLine*(s: Stream, args: varargs[string, `$`]) =
|
||||||
for str in args: write(s, str)
|
for str in args: write(s, str)
|
||||||
write(s, "\n")
|
write(s, "\n")
|
||||||
|
|
||||||
proc read[T](s: Stream, result: var T) =
|
proc read*[T](s: Stream, result: var T) =
|
||||||
## generic read procedure. Reads `result` from the stream `s`.
|
## generic read procedure. Reads `result` from the stream `s`.
|
||||||
if readData(s, addr(result), sizeof(T)) != sizeof(T):
|
if readData(s, addr(result), sizeof(T)) != sizeof(T):
|
||||||
raise newEIO("cannot read from stream")
|
raise newEIO("cannot read from stream")
|
||||||
|
|
||||||
proc peek[T](s: Stream, result: var T) =
|
proc peek*[T](s: Stream, result: var T) =
|
||||||
## generic peek procedure. Peeks `result` from the stream `s`.
|
## generic peek procedure. Peeks `result` from the stream `s`.
|
||||||
if peekData(s, addr(result), sizeof(T)) != sizeof(T):
|
if peekData(s, addr(result), sizeof(T)) != sizeof(T):
|
||||||
raise newEIO("cannot read from stream")
|
raise newEIO("cannot read from stream")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue