1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: deprecate read_at and add read_from to implement RandomReader (#9371)

This commit is contained in:
zakuro 2021-03-19 19:35:08 +09:00 committed by GitHub
parent f8fcf3ff66
commit 29884fa2a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,7 +287,13 @@ pub fn (f &File) read(mut buf []byte) ?int {
}
// read_at reads `buf.len` bytes starting at file byte offset `pos`, in `buf`.
[deprecated: 'use File.read_from() instead']
pub fn (f &File) read_at(pos int, mut buf []byte) ?int {
return f.read_from(pos, mut buf)
}
// read_from implements the RandomReader interface.
pub fn (f &File) read_from(pos int, mut buf []byte) ?int {
if buf.len == 0 {
return 0
}