mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
io: add missing documentation and edit existing ones (#17105)
This commit is contained in:
@@ -19,7 +19,7 @@ fn (err NotExpected) code() int {
|
||||
return err.code
|
||||
}
|
||||
|
||||
// Reader represents a stream of data that can be read
|
||||
// Reader represents a stream of data that can be read.
|
||||
pub interface Reader {
|
||||
// read reads up to buf.len bytes and places
|
||||
// them into buf.
|
||||
@@ -35,7 +35,7 @@ const (
|
||||
)
|
||||
|
||||
// ReadAllConfig allows options to be passed for the behaviour
|
||||
// of read_all
|
||||
// of read_all.
|
||||
pub struct ReadAllConfig {
|
||||
read_to_end_of_stream bool
|
||||
mut:
|
||||
@@ -43,7 +43,7 @@ mut:
|
||||
}
|
||||
|
||||
// read_all reads all bytes from a reader until either a 0 length read
|
||||
// or if read_to_end_of_stream is true then the end of the stream (`none`)
|
||||
// or if read_to_end_of_stream is true then the end of the stream (`none`).
|
||||
pub fn read_all(config ReadAllConfig) ![]u8 {
|
||||
mut r := config.reader
|
||||
read_till_eof := config.read_to_end_of_stream
|
||||
@@ -64,7 +64,7 @@ pub fn read_all(config ReadAllConfig) ![]u8 {
|
||||
}
|
||||
|
||||
// read_any reads any available bytes from a reader
|
||||
// (until the reader returns a read of 0 length)
|
||||
// (until the reader returns a read of 0 length).
|
||||
pub fn read_any(mut r Reader) ![]u8 {
|
||||
mut b := []u8{len: io.read_all_len}
|
||||
mut read := 0
|
||||
@@ -81,7 +81,7 @@ pub fn read_any(mut r Reader) ![]u8 {
|
||||
return b[..read]
|
||||
}
|
||||
|
||||
// RandomReader represents a stream of data that can be read from at a random location
|
||||
// RandomReader represents a stream of readable data from at a random location.
|
||||
pub interface RandomReader {
|
||||
read_from(pos u64, mut buf []u8) !int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user