Skip to content

Commit

Permalink
impl Debug for State closes #3676 (#3677)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
JonasKruckenberg and lucasfernog committed Mar 12, 2022
1 parent cf53761 commit 0b49dd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/state-debug.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Implement `Debug` for `tauri::State`.
6 changes: 6 additions & 0 deletions core/tauri/src/state.rs
Expand Up @@ -37,6 +37,12 @@ impl<T: Send + Sync + 'static> Clone for State<'_, T> {
}
}

impl<'r, T: Send + Sync + std::fmt::Debug> std::fmt::Debug for State<'r, T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("State").field(&self.0).finish()
}
}

impl<'r, 'de: 'r, T: Send + Sync + 'static, R: Runtime> CommandArg<'de, R> for State<'r, T> {
/// Grabs the [`State`] from the [`CommandItem`]. This will never fail.
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError> {
Expand Down

0 comments on commit 0b49dd5

Please sign in to comment.