Skip to main content

WriteToBytes

Trait WriteToBytes 

Source
pub trait WriteToBytes: Writer {
    // Required method
    fn write_to_vec(&self) -> Result<Vec<u8>>;

    // Provided method
    fn write_to<W: Write>(&self, writer: &mut W) -> Result<()> { ... }
}
Expand description

Common interface for writers that can emit a complete file payload.

This complements Writer::write for callers that need to send bytes over the network, store them in an archive, or run roundtrips without temporary files.

Required Methods§

Source

fn write_to_vec(&self) -> Result<Vec<u8>>

Write all added data into a byte vector.

Provided Methods§

Source

fn write_to<W: Write>(&self, writer: &mut W) -> Result<()>

Write all added data into an arbitrary byte sink.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl WriteToBytes for FbxWriter

Available on crate feature fbx-writer only.
Source§

impl WriteToBytes for GltfWriter

Available on crate feature gltf-writer only.
Source§

impl WriteToBytes for ObjWriter

Available on crate feature obj-writer only.
Source§

impl WriteToBytes for PlyWriter

Available on crate feature ply-writer only.