rstd 0.1.0
Loading...
Searching...
No Matches
rstd::io::BufWriter< W > Class Template Referenceexport
module rstd

A buffered wrapper around a writer, reducing the number of write syscalls. More...

Public Member Functions

 BufWriter (W inner, usize capacity=DEFAULT_BUF_SIZE)
 Creates a new BufWriter with the specified buffer capacity.
 
auto get_ref () const noexcept -> const W &
 Returns a reference to the underlying writer.
 
auto get_mut () noexcept -> W &
 Returns a mutable reference to the underlying writer.
 
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 not yet been flushed.
 
auto into_inner () &&-> W
 Consumes this BufWriter, flushing and returning the underlying writer.
 

Friends

struct rstd::Impl< io::Write, BufWriter< W > >
 
struct rstd::Impl< io::Seek, BufWriter< W > >
 

Detailed Description

template<typename W>
requires Impled<W, io::Write>
class rstd::io::BufWriter< W >

A buffered wrapper around a writer, reducing the number of write syscalls.

Template Parameters
WThe underlying writer type, which must implement io::Write.

Constructor & Destructor Documentation

◆ BufWriter()

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

Creates a new BufWriter with the specified buffer capacity.

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

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