lkml.org 
[lkml]   [2023]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subject[RFC 0/5] rust: sync: Arc: Implement Debug and Display
    Date
    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

    \
     
     \ /
      Last update: 2023-03-27 00:06    [W:3.045 / U:0.724 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site