summaryrefslogtreecommitdiff
path: root/serde_v8/magic/buffer.rs
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2022-04-24 09:28:46 -0300
committerGitHub <noreply@github.com>2022-04-24 09:28:46 -0300
commit4b7d306a198d020ce2b6fa1c758c71714bfd036c (patch)
tree10de79efbbd30107d0f04538c351b0765ec97a06 /serde_v8/magic/buffer.rs
parent2eb8c3b82fd54027c35c87ccc94797e34e2e95fd (diff)
perf(serde_v8): zero-copy StringOrBuffer (#14381)
Diffstat (limited to 'serde_v8/magic/buffer.rs')
-rw-r--r--serde_v8/magic/buffer.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/serde_v8/magic/buffer.rs b/serde_v8/magic/buffer.rs
index 3a8c9499b..dfa6928fb 100644
--- a/serde_v8/magic/buffer.rs
+++ b/serde_v8/magic/buffer.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+use std::fmt::Debug;
use std::ops::Deref;
use std::ops::DerefMut;
use std::sync::Mutex;
@@ -21,6 +22,12 @@ pub enum MagicBuffer {
impl_magic!(MagicBuffer);
+impl Debug for MagicBuffer {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_list().entries(self.as_ref().iter()).finish()
+ }
+}
+
impl MagicBuffer {
pub fn empty() -> Self {
MagicBuffer::ToV8(Mutex::new(Some(vec![0_u8; 0].into_boxed_slice())))