All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/5] rust: sync: Arc: Implement Debug and Display
@ 2023-02-01 23:22 Boqun Feng
  2023-02-01 23:22 ` [RFC 1/5] rust: sync: impl Display for {Unique,}Arc Boqun Feng
                   ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Boqun Feng @ 2023-02-01 23:22 UTC (permalink / raw)
  To: rust-for-linux, linux-kernel
  Cc: Will Deacon, Peter Zijlstra, Mark Rutland, Miguel Ojeda,
	Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo,
	Björn Roy Baron, Vincenzo Palazzo

I found that our Arc doesn't implement `Debug` or `Display` when I tried
to play with them, therefore add these implementation.

With these changes, I could get the following print with the sample code
in patch #5:

	[..] rust_print: 1
	[..] rust_print: UniqueArc { inner: Arc { refcount: 1, data: "hello, world" } }
	[..] rust_print: [samples/rust/rust_print.rs:34] c = Arc {
	[..]     refcount: 2,
	[..]     data: "hello, world",
	[..] }
	[..] rust_print: Arc {
	[..]     refcount: 0x1,
	[..]     data: "hello, world",
	[..] }

Note that I make the `Debug` implementation of `Arc` also print the
current reference count, which I think may be useful: myself sometimes
wonder "how many references exist at this point" during my own
development. But I'm open to suggestions and changes.

Wedson, I know that you are considering to get rid of `ArcBorrow`, so
the patch #3 may have some conflicts with what you may be working on.
I'm happy to wait and rebase since this series is not something urgent
;-)

Suggestions and comments are welcome!

Regards,
Boqun

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2023-02-04 19:05 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 23:22 [RFC 0/5] rust: sync: Arc: Implement Debug and Display Boqun Feng
2023-02-01 23:22 ` [RFC 1/5] rust: sync: impl Display for {Unique,}Arc Boqun Feng
2023-02-02 14:15   ` Gary Guo
2023-02-02 16:50   ` Björn Roy Baron
2023-02-04 10:20   ` Finn Behrens
2023-02-04 18:47   ` Vincenzo Palazzo
2023-02-01 23:22 ` [RFC 2/5] rust: sync: Arc: Introduces ArcInner::count() Boqun Feng
2023-02-02  9:14   ` Peter Zijlstra
2023-02-02 13:46     ` Boqun Feng
2023-02-02 14:21     ` Gary Guo
2023-02-02 15:41       ` Greg KH
2023-02-02 16:10         ` Boqun Feng
2023-02-02 16:17           ` Greg KH
2023-02-02 16:51             ` Boqun Feng
2023-02-02 21:47               ` Miguel Ojeda
2023-02-03  5:22                 ` Greg KH
2023-02-03  7:25                   ` Boqun Feng
2023-02-03  7:38                     ` Greg KH
2023-02-03  7:43                       ` Boqun Feng
2023-02-03  8:01                       ` Boqun Feng
2023-02-03 19:17                       ` Josh Stone
2023-02-03 19:22                         ` Wedson Almeida Filho
2023-02-02 14:22   ` Gary Guo
2023-02-04 18:48   ` Vincenzo Palazzo
2023-02-01 23:22 ` [RFC 3/5] rust: sync: Arc: Introduces Arc::get_inner() helper Boqun Feng
2023-02-02 14:24   ` Gary Guo
2023-02-02 16:53   ` Björn Roy Baron
2023-02-04 18:51   ` Vincenzo Palazzo
2023-02-01 23:22 ` [RFC 4/5] rust: sync: impl Debug for {Unique,}Arc Boqun Feng
2023-02-02 14:28   ` Gary Guo
2023-02-03 19:46     ` Boqun Feng
2023-02-04 18:56   ` Vincenzo Palazzo
2023-02-01 23:22 ` [RFC 5/5] sample: rust: print: Add sampe code for Arc printing Boqun Feng
2023-02-02 16:56   ` Björn Roy Baron
2023-02-04 10:22   ` Finn Behrens
2023-02-04 19:05   ` Vincenzo Palazzo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.