From 7310ef0660ab1166701678bb5a1dbb452949c586 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 13 Nov 2024 16:30:35 +0800 Subject: [PATCH] chore: Polish the debug output of capability Signed-off-by: Xuanwo --- core/src/types/capability.rs | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/core/src/types/capability.rs b/core/src/types/capability.rs index 1e351d69a69f..aa3dffaed6cc 100644 --- a/core/src/types/capability.rs +++ b/core/src/types/capability.rs @@ -169,42 +169,22 @@ pub struct Capability { impl Debug for Capability { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let mut s = vec![]; - - if self.stat { - s.push("Stat"); - } + // NOTE: All services in opendal are readable. if self.read { - s.push("Read"); + f.write_str("Read")?; } if self.write { - s.push("Write"); - } - if self.create_dir { - s.push("CreateDir"); - } - if self.delete { - s.push("Delete"); - } - if self.copy { - s.push("Copy"); - } - if self.rename { - s.push("Rename"); + f.write_str("| Write")?; } if self.list { - s.push("List"); + f.write_str("| List")?; } if self.presign { - s.push("Presign"); - } - if self.batch { - s.push("Batch"); + f.write_str("| Presign")?; } if self.blocking { - s.push("Blocking"); + f.write_str("| Blocking")?; } - - write!(f, "{{ {} }}", s.join(" | ")) + Ok(()) } }