We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d14be6 commit 7d6ebf0Copy full SHA for 7d6ebf0
lib/vector-common/src/byte_size_of.rs
@@ -47,12 +47,14 @@ struct ByteCountWriter {
47
}
48
49
impl std::io::Write for ByteCountWriter {
50
+ #[inline]
51
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
52
let bytes = buf.len();
53
self.bytes += bytes;
54
Ok(bytes)
55
56
57
58
fn flush(&mut self) -> std::io::Result<()> {
59
Ok(())
60
@@ -66,6 +68,7 @@ impl<T> JsonEncodedSizeOf for T
66
68
where
67
69
T: serde::Serialize,
70
{
71
72
fn json_encoded_size_of(&self) -> usize {
73
let mut writer = ByteCountWriter::default();
74
let _ = serde_json::to_writer(&mut writer, self);
0 commit comments