Skip to content

Commit

Permalink
Display String contents in Debug implementation. (#1227)
Browse files Browse the repository at this point in the history
### What

Display `String` contents in `Debug` implementation.

### Why

Improve testing/debugging UX

### Known limitations

N/A
  • Loading branch information
dmkozh authored Feb 14, 2024
1 parent 1d7f9bd commit 02cd291
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion soroban-sdk/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub struct String {

impl Debug for String {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "String()")?;
#[cfg(target_family = "wasm")]
write!(f, "String(..)")?;
#[cfg(not(target_family = "wasm"))]
write!(f, "String({})", self.to_string())?;
Ok(())
}
}
Expand Down

0 comments on commit 02cd291

Please sign in to comment.