Skip to content

Commit

Permalink
chore: Polish the debug output of capability
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Nov 13, 2024
1 parent 7b18680 commit 7310ef0
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions core/src/types/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}

0 comments on commit 7310ef0

Please sign in to comment.