错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Coercions

  • Nouman Azam

摘要

This chapter focuses on the concept of type coercion in Rust, a powerful mechanism that allows one type to be automatically converted into another when certain conditions are met. It begins by exploring the basics of coercion, including the widely used deref coercion, which enables seamless access between smart pointers, references, and owned types. The discussion then moves to various coercion sites, identifying where and how coercions occur in code.