From 29884fa2a9f1c845d87728c8b0411bc2ef0baaa9 Mon Sep 17 00:00:00 2001 From: zakuro Date: Fri, 19 Mar 2021 19:35:08 +0900 Subject: [PATCH] os: deprecate read_at and add read_from to implement RandomReader (#9371) --- vlib/os/file.c.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/os/file.c.v b/vlib/os/file.c.v index 96b27a2bdd..3667211508 100644 --- a/vlib/os/file.c.v +++ b/vlib/os/file.c.v @@ -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 }