protobuf/coded_output_stream/
output_target.rsuse std::fmt;
use std::io::Write;
pub(crate) enum OutputTarget<'a> {
Write(&'a mut dyn Write, Vec<u8>),
Vec(&'a mut Vec<u8>),
Bytes,
}
impl<'a> fmt::Debug for OutputTarget<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
OutputTarget::Write(_w, vec) => f
.debug_struct("Write")
.field("buf_len", &vec.len())
.field("buf_cap", &vec.capacity())
.finish_non_exhaustive(),
OutputTarget::Vec(vec) => f
.debug_struct("Vec")
.field("len", &vec.len())
.field("cap", &vec.capacity())
.finish_non_exhaustive(),
OutputTarget::Bytes => f.debug_tuple("Bytes").finish(),
}
}
}