linebender/druid

Sameness for fresh clones

開放

#944 建立於 2020年5月15日

 (2 則留言) (0 個反應) (0 位負責人)Rust (567 個分叉)batch import
D-Easydocshelp wanted

倉庫指標

星標
 (9,091 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Would it make sense to add to the doc of Data::same that the following property is recommended (or even required)?

assert!(x.same(&x.clone()))

I'm asking because there were some confusion about how to implement Data::same for im::Vector in https://github.com/bodil/im-rs/issues/117 and https://github.com/bodil/im-rs/issues/129. The current doc of Data::same would even allow the following implementation.

impl Data for Foo {
    fn same(&self, _other: &Self) -> bool {
        false
    }
}

貢獻者指南