Contents

read(_:)

Reads the current contents of the buffer resource synchronously on the CPU.

Declaration

final func read<R, E>(_ body: (RawSpan) throws(E) -> R) throws(E) -> R where E : Error, R : ~Copyable

Parameters

  • body:

    A closure that receives a read-only span over the buffer’s bytes.

Discussion

You pass a closure that receives a read-only span representing the contents of the buffer resource. This span is valid only for the duration of the closure.

See Also

Reading buffer contents