Skip to main content

collect_stream

Function collect_stream 

Source
pub fn collect_stream<F>(func: F) -> Result<String>
where F: FnOnce(&mut dyn Write) -> Result,
Expand description

Collects text emitted by a callback into an owned string.

The callback receives a formatting writer backed by a new String. Its error is propagated, and the buffer is returned only after the callback succeeds.