rstd 0.1.0
Loading...
Searching...
No Matches
rstd::io::BufReader< R > Class Template Referenceexport
module rstd

A buffered wrapper around a reader, reducing the number of read syscalls. More...

Public Member Functions

 BufReader (R inner, usize capacity=DEFAULT_BUF_SIZE)
 Creates a new BufReader with the specified buffer capacity.
 
auto get_ref () const noexcept -> const R &
 Returns a reference to the underlying reader.
 
auto get_mut () noexcept -> R &
 Returns a mutable reference to the underlying reader.
 
auto capacity () const noexcept -> usize
 Returns the total capacity of the internal buffer.
 
auto buffer () const noexcept -> slice< u8 >
 Returns a slice of the buffered data that has been read but not yet consumed.
 
void discard_buffer () noexcept
 Discard the internal buffer (call after seeking inner directly).
 
auto into_inner () &&-> R
 Unwrap the inner reader (discards any buffered data).
 

Detailed Description

template<typename R>
requires Impled<R, io::Read>
class rstd::io::BufReader< R >

A buffered wrapper around a reader, reducing the number of read syscalls.

Template Parameters
RThe underlying reader type, which must implement io::Read.

Constructor & Destructor Documentation

◆ BufReader()

template<typename R >
rstd::io::BufReader< R >::BufReader ( R inner,
usize capacity = DEFAULT_BUF_SIZE )
inlineexplicit

Creates a new BufReader with the specified buffer capacity.

Parameters
innerThe underlying reader.
capacityThe buffer size in bytes (defaults to DEFAULT_BUF_SIZE).

The documentation for this class was generated from the following file: