Re: [PATCH v1 2/2] rust: sync: implement `AsRef<T>` for `Arc<T>`

From: Martin Rodriguez Reboredo
Date: Wed May 17 2023 - 16:42:33 EST


On 5/17/23 17:08, Alice Ryhl wrote:
[...]
+impl<T: ?Sized> AsRef<T> for Arc<T> {
+ fn as_ref(&self) -> &T {
+ self.deref()
+ }
+}
+
impl<T: ?Sized> Clone for Arc<T> {
fn clone(&self) -> Self {
// INVARIANT: C `refcount_inc` saturates the refcount, so it cannot overflow to zero.

Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>