Skip to content

Commit 0b49dd5

Browse files
impl Debug for State closes #3676 (#3677)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent cf53761 commit 0b49dd5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changes/state-debug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Implement `Debug` for `tauri::State`.

core/tauri/src/state.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ impl<T: Send + Sync + 'static> Clone for State<'_, T> {
3737
}
3838
}
3939

40+
impl<'r, T: Send + Sync + std::fmt::Debug> std::fmt::Debug for State<'r, T> {
41+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42+
f.debug_tuple("State").field(&self.0).finish()
43+
}
44+
}
45+
4046
impl<'r, 'de: 'r, T: Send + Sync + 'static, R: Runtime> CommandArg<'de, R> for State<'r, T> {
4147
/// Grabs the [`State`] from the [`CommandItem`]. This will never fail.
4248
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError> {

0 commit comments

Comments
 (0)