std::io::* 2. Struct std::io::BufReader
https://doc.rust-lang.org/std/io/struct.BufReader.html
サマリ
small and repeated read calls to the same file or network socket. when reading very large amounts at once, or reading just one or a few times. >> 何の役にも立たない. マルチスレッドデータ損失リスク(
impl BufReader
pub fn new(inner: R) -> BufReader
pub fn with_capacity(capacity: usize, inner: R) -> BufReader
impl BufReader
pub fn get_ref(&self) -> &R
pub fn get_mut(&mut self) -> &mut R
pub fn buffer(&self) -> &[u8]
pub fn capacity(&self) -> usize
pub fn into_inner(self) -> R
impl BufReader
pub fn seek_relative(&mut self, offset: i64) -> Result<()>
サマリ
small and repeated read calls to the same file or network socket.
BufReader::into_inner
度)use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> std::io::Result<()>{
let f= File::open("log.txt")?;
let mut reader= BufReader::new(f);
let mut line= String::new();
let len= reader.read_line(&mut line)?;
println!("First line is {} bytes long", len);
Ok(())
}
Implementationsimpl
pub fn new(inner: R) -> BufReader
pub fn with_capacity(capacity: usize, inner: R) -> BufReader
impl BufReader
pub fn get_ref(&self) -> &R
pub fn get_mut(&mut self) -> &mut R
pub fn buffer(&self) -> &[u8]
pub fn capacity(&self) -> usize
pub fn into_inner(self) -> R
impl
pub fn seek_relative(&mut self, offset: i64) -> Result<()>
Reference
この問題について(std::io::* 2. Struct std::io::BufReader), 我々は、より多くの情報をここで見つけました https://velog.io/@dongsub-joung/stdio-2.-Struct-stdioBufReaderテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol