Trait VecSink

Source
pub trait VecSink: DataSink {
    // Required method
    fn write_owned_bytes(&mut self, buf: Vec<u8>) -> Result;
}
Expand description

A sink stream of vector data.

Required Methods§

Source

fn write_owned_bytes(&mut self, buf: Vec<u8>) -> Result

Writes all bytes from a Vec.

§Errors

May return Overflow if the sink would exceed some hard storage limit. In the case, the stream is filled completely, excluding the overflowing bytes.

§Examples
use data_streams::VecSink;

let mut buf = Vec::new();
buf.write_owned_bytes(b"Hello!".into())?;
assert_eq!(buf, b"Hello!");
§Implementation

By default, this delegates to write_bytes. Some implementations may be may better optimize for owned data.

Implementors§

Source§

impl<T: DataSink> VecSink for T