mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 03:14:08 +00:00
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:
@@ -146,12 +146,12 @@ proc writeLine*(s: Stream, args: varargs[string, `$`]) =
|
||||
for str in args: write(s, str)
|
||||
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`.
|
||||
if readData(s, addr(result), sizeof(T)) != sizeof(T):
|
||||
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`.
|
||||
if peekData(s, addr(result), sizeof(T)) != sizeof(T):
|
||||
raise newEIO("cannot read from stream")
|
||||
|
||||
Reference in New Issue
Block a user