pub trait BufferExt {
// Required methods
fn read_all(&self) -> Vec<u8> ⓘ;
fn read_to_string(&self) -> VtxResult<String>;
fn read_json<T: DeserializeOwned>(&self) -> VtxResult<T>;
fn write_all(&self, data: impl AsRef<[u8]>) -> u64;
}Expand description
Convenience extension methods for Buffer resources.
Required Methods§
Sourcefn read_all(&self) -> Vec<u8> ⓘ
fn read_all(&self) -> Vec<u8> ⓘ
Reads the entire Buffer.
- For file/memory: Uses
size()for chunked reading. - For pipe: Reads continuously until EOF (returns empty array) or
max_total_bytesis reached.
IO Boundary: This method reads a maximum of 64MB (MAX_TOTAL).
Sourcefn read_to_string(&self) -> VtxResult<String>
fn read_to_string(&self) -> VtxResult<String>
Reads the entire Buffer as UTF-8.
Sourcefn read_json<T: DeserializeOwned>(&self) -> VtxResult<T>
fn read_json<T: DeserializeOwned>(&self) -> VtxResult<T>
Deserializes JSON in the Buffer into the target type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.