Trait BufReadpub

Source
:trait(pub) BufRead { (Read Self) }
  .fill-buf ( Self  Self Bytes )
  .consume ( Self AnyUInt  Self )
  .read-line ( Self  Self (Result Str Str) )
  .read-until ( Self U8  Self (Result Bytes Str) )
Description

BufRead — Read plus buffer-aware operations. An implementation MUST maintain an internal buffer that decouples application-level reads from source-level reads.

Required Methods

.fill-buf ( Self Self Bytes )

Fill and return a view of the internal buffer.

.consume ( Self AnyUInt Self )

Mark n bytes of the internal buffer as consumed.

.read-line ( Self Self (Result Str Str) )

Read one line (UTF-8); returns the handle and a fallible Str.

.read-until ( Self U8 Self (Result Bytes Str) )

Read up to and including the delimiter byte; returns the handle and the collected bytes on success.