We have some types (such as Ref and Unalign) which implement Deref, and which provide methods (such as into_ref). This conflicts with the standard library's pattern of preferring associated functions over methods on types which implement Deref (e.g., Box::into_raw). This pattern is well-motivated: When a method is called on a Deref type, it is resolved on both the type itself and the target type (e.g., on both Box<T> and on T), and so methods on the type itself (Box<T>) can conflict with those on the target type (T). We should consider adopting this pattern.
We have some types (such as
RefandUnalign) which implementDeref, and which provide methods (such asinto_ref). This conflicts with the standard library's pattern of preferring associated functions over methods on types which implementDeref(e.g.,Box::into_raw). This pattern is well-motivated: When a method is called on aDereftype, it is resolved on both the type itself and the target type (e.g., on bothBox<T>and onT), and so methods on the type itself (Box<T>) can conflict with those on the target type (T). We should consider adopting this pattern.