[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230201232244.212908-1-boqun.feng@gmail.com>
Date: Wed, 1 Feb 2023 15:22:39 -0800
From: Boqun Feng <boqun.feng@...il.com>
To: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Vincenzo Palazzo <vincenzopalazzodev@...il.com>
Subject: [RFC 0/5] rust: sync: Arc: Implement Debug and Display
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
Powered by blists - more mailing lists