8.4. The Deref trait

The Deref trait

The Deref<Target = U> trait allows a type to implicitly implement all the methods of the type U. When attempting to resolve a method call, the compiler will search the top-level type for the implementation of the called method. If no such method is found, .deref() is called and the compiler continues to search for the method implementation in the returned type U.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/reference/the-deref-trait.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部