Skip to main content

encode_to_writer_with_config

Function encode_to_writer_with_config 

Source
pub fn encode_to_writer_with_config<E: Encode, W: Write, C: Config>(
    value: &E,
    writer: W,
    config: C,
) -> Result<usize>
Available on crate feature std only.
Expand description

Encode value into any std::io::Write using a custom configuration.

Returns the number of bytes written. This is a convenience wrapper around encode_into_std_write for ergonomics.

ยงExamples

use std::io::Cursor;
let mut buf = Cursor::new(Vec::new());
let n = oxicode::encode_to_writer_with_config(&42u32, &mut buf, oxicode::config::standard())
    .expect("encode");
assert!(n > 0);