Skip to content

Commit

Permalink
Update Debug Implementation to type_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Sep 2, 2023
1 parent 898de87 commit 3d1b767
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/yew-agent/src/oneshot/provider.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::fmt;
use std::any::type_name;
use std::cell::RefCell;
use std::rc::Rc;

Expand All @@ -25,7 +26,7 @@ where
T: Oneshot,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("OneshotProviderState<_>")
f.write_str(type_name::<Self>())
}
}

Expand Down
5 changes: 3 additions & 2 deletions packages/yew-agent/src/reactor/hooks.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::fmt;
use std::ops::Deref;
use std::rc::Rc;
Expand Down Expand Up @@ -55,7 +56,7 @@ where
<R::Scope as ReactorScoped>::Input: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UseReactorBridgeHandle<_>")
f.debug_struct(type_name::<Self>())
.field("inner", &self.tx)
.finish()
}
Expand Down Expand Up @@ -214,7 +215,7 @@ where
<R::Scope as ReactorScoped>::Output: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UseReactorSubscriptionHandle<_>")
f.debug_struct(type_name::<Self>())
.field("bridge", &self.bridge)
.field("outputs", &self.outputs)
.finish()
Expand Down
3 changes: 2 additions & 1 deletion packages/yew-agent/src/reactor/provider.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::cell::RefCell;
use std::fmt;
use std::rc::Rc;
Expand Down Expand Up @@ -26,7 +27,7 @@ where
T: Reactor,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("ReactorProviderState<_>")
f.write_str(type_name::<Self>())
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/yew-agent/src/scope_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! This module contains extensions to the component scope for agent access.

use std::any::type_name;
use std::fmt;
use std::rc::Rc;

Expand Down Expand Up @@ -50,8 +51,7 @@ where
R: Reactor + 'static,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ReactorBridgeHandle<_>")
.finish_non_exhaustive()
f.debug_struct(type_name::<Self>()).finish_non_exhaustive()
}
}

Expand Down
5 changes: 3 additions & 2 deletions packages/yew-agent/src/worker/hooks.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::fmt;
use std::ops::Deref;
use std::rc::Rc;
Expand Down Expand Up @@ -52,7 +53,7 @@ where
T: Worker,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UseWorkerBridgeHandle<_>")
f.debug_struct(type_name::<Self>())
.field("inner", &self.inner)
.finish()
}
Expand Down Expand Up @@ -157,7 +158,7 @@ where
T::Output: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UseWorkerSubscriptionHandle<_>")
f.debug_struct(type_name::<Self>())
.field("bridge", &self.bridge)
.field("outputs", &self.outputs)
.finish()
Expand Down
3 changes: 2 additions & 1 deletion packages/yew-agent/src/worker/provider.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::cell::RefCell;
use std::fmt;
use std::rc::Rc;
Expand Down Expand Up @@ -53,7 +54,7 @@ where
W: Worker,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("WorkerProviderState<_>")
f.write_str(type_name::<Self>())
}
}

Expand Down

0 comments on commit 3d1b767

Please sign in to comment.